-
Notifications
You must be signed in to change notification settings - Fork 96
Integration tests for N1C metrics #1210
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
base: main
Are you sure you want to change the base?
Conversation
// osVersion := Env(tb, "OS_VERSION") | ||
buildTarget := Env(tb, "BUILD_TARGET") | ||
dockerfilePath := Env(tb, "DOCKERFILE_PATH") | ||
// containerRegistry := Env(tb, "CONTAINER_NGINX_IMAGE_REGISTRY") |
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 code block is all commented out
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.
I ran into an issue with setting up the container for agent with NGINX Plus so I commented out the code for now until I can sort it.
s.teardownTest(s.T()) | ||
} | ||
|
||
func (s *MetricsTestSuite) TestNginxOSS_Test1_TestRequestCount() { |
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.
Can you remove the Test1/Test2 from the test titles? The name itself will be the identifier
s.Require().NoError(err) | ||
} | ||
|
||
time.Sleep(65 * time.Second) |
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.
Best practice is not to have a hard coded sleep. Should replace with a method to loop curling the otel collector until metrics is available. This method can be reused for other tests.
} | ||
|
||
func (s *MetricsTestSuite) TestNginxOSS_Test2_TestResponseCode() { | ||
family := s.metricFamilies["nginx_http_response_count"] |
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.
Generating metrics could help increase the test coverage.
for code := range responseCodes { | ||
codeRes = append(codeRes, utils.SumMetricFamilyLabel(family, "nginx_status_range", responseCodes[code])) | ||
s.T().Logf("NGINX HTTP response code %s total: %v", responseCodes[code], codeRes[code]) | ||
s.Require().NotNil(codeRes[code]) |
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.
Generating metrics could expand the assertions so we know certain response codes are of a particular value.
Proposed changes
This PR aims to add integration tests for N1C metrics.
Checklist
Before creating a PR, run through this checklist and mark each as complete.
CONTRIBUTING
documentmake install-tools
and have attached any dependency changes to this pull requestREADME.md
)