Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
musa-asad committed Dec 17, 2024
1 parent 0db3337 commit 803bad7
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions test/e2e/jmx/jmx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,17 @@ func init() {
environment.RegisterEnvironmentMetaDataFlags()
}

type TestConfig struct {
metricTests []func(*testing.T)
}

var testRegistry = map[string]TestConfig{
var testRegistry = map[string][]func(*testing.T){
"jvm_tomcat.json": {
metricTests: []func(*testing.T){
testTomcatMetrics,
testTomcatSessions,
},
testTomcatMetrics,
testTomcatSessions,
},
"kafka.json": {
metricTests: []func(*testing.T){
testKafkaMetrics,
},
testKafkaMetrics,
},
"containerinsights.json": {
metricTests: []func(*testing.T){
testContainerInsightsMetrics,
testTomcatRejectedSessions,
},
testContainerInsightsMetrics,
testTomcatRejectedSessions,
},
}

Expand Down Expand Up @@ -182,13 +172,13 @@ func TestMetrics(t *testing.T) {
env := environment.GetEnvironmentMetaData()
configFile := filepath.Base(env.AgentConfig)

config, exists := testRegistry[configFile]
tests, exists := testRegistry[configFile]
if !exists {
t.Skipf("No tests registered for config file: %s", configFile)
return
}

for _, testFunc := range config.metricTests {
for _, testFunc := range tests {
testFunc(t)
}
}
Expand Down

0 comments on commit 803bad7

Please sign in to comment.