-
Notifications
You must be signed in to change notification settings - Fork 14
Add e2e tests for static targets #30
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,8 +20,10 @@ import ( | |
| _ "github.com/prometheus/prometheus/discovery/kubernetes" | ||
| ) | ||
|
|
||
| // nolint: paralleltest,tparallel | ||
| func TestParser(t *testing.T) { | ||
| t.Parallel() | ||
| t.Setenv(configurator.LicenseKeyEnvKey, "") | ||
| t.Setenv(configurator.DataSourceNameEnvKey, "") | ||
|
Comment on lines
+25
to
+26
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was hitting an error since i configured the env vars to run the Tilt environment.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure I am following, are they colliding?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test also covers the code where these env vars are expanded, if you have them in the session you are execute them , the test will fail (because of the expectations are checking other values for these). |
||
|
|
||
| // it relies on testdata/<placeholder>.yaml and testdata/<placeholder>.expected.yaml | ||
| testCases := []string{ | ||
|
|
@@ -51,6 +53,9 @@ func TestParser(t *testing.T) { | |
|
|
||
| //nolint: tparallel | ||
| func TestDataSourceName(t *testing.T) { | ||
| t.Setenv(configurator.LicenseKeyEnvKey, "") | ||
| t.Setenv(configurator.DataSourceNameEnvKey, "") | ||
|
|
||
| configWithDataSourceName := ` | ||
| data_source_name: %s | ||
| newrelic_remote_write: | ||
|
|
@@ -79,6 +84,9 @@ newrelic_remote_write: | |
|
|
||
| //nolint: tparallel | ||
| func TestLicenseKey(t *testing.T) { | ||
| t.Setenv(configurator.LicenseKeyEnvKey, "") | ||
| t.Setenv(configurator.DataSourceNameEnvKey, "") | ||
|
|
||
| configWithLicense := ` | ||
| newrelic_remote_write: | ||
| license_key: %s | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| entities: | ||
| - entityType: FakeSelfMetrics | ||
| metrics: | ||
| - name: prometheus_agent_active_series | ||
| - name: prometheus_target_interval_length_seconds | ||
| - name: prometheus_target_scrape_pool_targets | ||
| - name: prometheus_remote_storage_samples_pending | ||
| - name: prometheus_remote_storage_samples_in_total | ||
| - name: prometheus_remote_storage_samples_retried_total | ||
| - name: prometheus_agent_corruptions_total | ||
| - name: prometheus_remote_storage_shards | ||
| - name: prometheus_sd_kubernetes_events_total | ||
| - name: prometheus_agent_checkpoint_creations_failed_total | ||
| - name: prometheus_agent_checkpoint_deletions_failed_total | ||
| - name: prometheus_remote_storage_dropped_samples_total | ||
| - name: prometheus_remote_storage_failed_samples_total | ||
| - name: prometheus_sd_kubernetes_http_request_total | ||
| - name: prometheus_agent_truncate_duration_seconds_sum | ||
| - name: prometheus_build_info | ||
| - name: process_resident_memory_bytes | ||
| - name: process_virtual_memory_bytes | ||
| - name: process_cpu_seconds_total | ||
| - name: scrape_pool_targets | ||
| - name: scrape_duration_seconds |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| description: Newrelic Prometheus Configurator E2E Test | ||
|
|
||
| custom_test_key: cluster_name | ||
|
|
||
| scenarios: | ||
| - description: Scrape test environment metrics | ||
| before: | ||
| - cd ../../ && NR_PROM_LICENSE_KEY=${LICENSE_KEY} NR_PROM_CLUSTER=${SCENARIO_TAG} make tilt-ci | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, this is not that nice, could it be a step of the pipeline? How nri-kubernetes works without this?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also below tilt down is way more clear and simple
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agree is ugly, but is not complex i would say, is the simpler and clear solution i came up to actually re-use the make target and not duplicate bash scripts all over the repo.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like there is another way but i found it more obscure WDYT |
||
| after: | ||
| - tilt down | ||
| tests: | ||
| metrics: | ||
| - source: "metrics.yml" | ||
| except_metrics: | ||
| # TODO check why this ones don't appear | ||
| - prometheus_remote_storage_dropped_samples_total | ||
| - prometheus_remote_storage_failed_samples_total | ||
| - scrape_pool_targets | ||
|
|
||
| # Need to activate kubernetes_sd for this metric to appear | ||
| - prometheus_sd_kubernetes_http_request_total | ||
Uh oh!
There was an error while loading. Please reload this page.