-
Notifications
You must be signed in to change notification settings - Fork 77
[integration_test] Add RunForEachImageAndFeatureFlag and improve Otel Logging integration tests.
#2102
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
Conversation
| } | ||
|
|
||
| // RunForEachImageAndLoggingSubagent runs a subtest for each image and logging subagent (fluent-bit, otel). | ||
| func RunForEachImageAndLoggingSubagent(t *testing.T, testBody func(t *testing.T, imageSpec string, otel bool)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change it to be agnostic of what you are testing.
RunForEachImageAndFeatureFlag
func RunForEachImageAndFeatureFlag(t *testing.T, []string features, testBody func(t *testing.T, imageSpec string, feature string)) {
gce.RunForEachImage(t, func(t *testing.T, imageSpec string) {
t.Parallel()
// Run base case also
t.Run("default", func(t *testing.T) {
testBody(t, "default")
})
for _, feature := range featureList {
t.Run(feature, func(t *testing.T) {
testBody(t, feature)
})
}
})
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
| func TestCustomLogFormat(t *testing.T) { | ||
| t.Parallel() | ||
| RunForEachLoggingSubagent(t, func(t *testing.T, otel bool) { | ||
| RunForEachImageAndLoggingSubagent(t, func(t *testing.T, imageSpec string, otel bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would change to:
RunForEachFeatureFlag(t, []string{"otel"}, func(t *testing.T, feature string) {
you can check for your feature by checking the value of feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
| // setExperimentalFeatures sets the EXPERIMENTAL_FEATURES environment variable. | ||
| func setExperimentalFeatures(ctx context.Context, logger *log.Logger, vm *gce.VM, feature string) error { | ||
| return gce.SetEnvironmentVariables(ctx, logger, vm, map[string]string{"EXPERIMENTAL_FEATURES": feature}) | ||
| // SetupOpsAgentForLoggingSubagent configures the VM and the config depending on the selected logging subagent (fluent-bit, otel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also make this generic so other features can be used. Maybe pass in a function instead of coding it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
rafaelwestphal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I think this looks much better now :)
RunForEachImageAndLoggingSubagent and improve Otel Logging integration tests.RunForEachImageAndFeatureFlag and improve Otel Logging integration tests.
|
All 3P app failures are unrelated. Flake on |
Description
Created
RunForEachImageAndFeatureFlagand other test helper functions. The goal is that followup PR "diffs" to convert an existing test to be anOtel Loggingtest is minimal.Related issue
b/416048587
How has this been tested?
Checklist: