Skip to content

Skip deprecation warnings bad request for Serverless or Environment providers #2514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions internal/testrunner/runners/system/tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,16 @@ type deprecationWarning struct {
}

func (r *tester) getDeprecationWarnings(ctx context.Context, dataStream string) ([]deprecationWarning, error) {
config, err := stack.LoadConfig(r.profile)
if err != nil {
return []deprecationWarning{}, fmt.Errorf("failed to load config from profile: %w", err)
}
if config.Provider == stack.ProviderServerless {
logger.Tracef("Skip deprecation warnings validation in Serverless projects")
// In serverless, there is no handler for this request. Ignore this validation.
// Example of response: [400 Bad Request] {"error":"no handler found for uri [/metrics-elastic_package_registry.metrics-62481/_migration/deprecations] and method [GET]"}
return []deprecationWarning{}, nil
}
resp, err := r.esAPI.Migration.Deprecations(
r.esAPI.Migration.Deprecations.WithContext(ctx),
r.esAPI.Migration.Deprecations.WithIndex(dataStream),
Expand All @@ -900,6 +910,14 @@ func (r *tester) getDeprecationWarnings(ctx context.Context, dataStream string)
}
defer resp.Body.Close()

if resp.StatusCode == http.StatusBadRequest {
if config.Provider == stack.ProviderEnvironment {
// Ignore errors in provider environment too, in this case it could also be a Serverless project.
logger.Tracef("Ignored deprecation warnings bad request code error in provider environment, response: %s", resp.String())
return []deprecationWarning{}, nil
}
}

if resp.IsError() {
return nil, fmt.Errorf("unexpected status code in response: %s", resp.String())
}
Expand Down