Skip to content

Commit

Permalink
fix: expand test flag
Browse files Browse the repository at this point in the history
  • Loading branch information
vsukhin committed Jun 20, 2024
1 parent 70f46b2 commit 9e8a59a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contrib/executor/jmeterd/pkg/runner/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func getTestPathAndWorkingDir(fs filesystem.FileSystem, execution *testkube.Exec
if arg == jmeterTestFileFlag {
if (i + 1) < len(execution.Args) {
if execution.Args[i+1] != "<runPath>" {
testFlag = execution.Args[i+1]
testFlag = os.ExpandEnv(execution.Args[i+1])
i++
continue
}
Expand Down
5 changes: 3 additions & 2 deletions internal/app/api/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ var testWorkflowTemplateDeletesCount = promauto.NewCounterVec(prometheus.Counter
var testTriggerEventCount = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "testkube_testtrigger_event_count",
Help: "The total number of test trigger events",
}, []string{"resource", "eventType", "causes"})
}, []string{"name", "resource", "eventType", "causes"})

func NewMetrics() Metrics {
return Metrics{
Expand Down Expand Up @@ -489,9 +489,10 @@ func (m Metrics) IncDeleteTestWorkflowTemplate(err error) {
}).Inc()
}

func (m Metrics) IncTestTriggerEventCount(resource, eventType string, causes []string) {
func (m Metrics) IncTestTriggerEventCount(name, resource, eventType string, causes []string) {
slices.Sort(causes)
m.TestTriggerEventCount.With(map[string]string{
"name": name,
"resource": resource,
"eventType": eventType,
"causes": strings.Join(causes, ","),
Expand Down
2 changes: 1 addition & 1 deletion pkg/triggers/matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (s *Service) match(ctx context.Context, e *watcherEvent) error {
causes = append(causes, string(cause))
}

s.metrics.IncTestTriggerEventCount(string(e.resource), string(e.eventType), causes)
s.metrics.IncTestTriggerEventCount(t.Name, string(e.resource), string(e.eventType), causes)
if err := s.triggerExecutor(ctx, e, t); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/triggers/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func (s *Service) podEventHandler(ctx context.Context) cache.ResourceEventHandle
newPod.Namespace == s.testkubeNamespace && newPod.Labels["job-name"] != "" && newPod.Labels[testkube.TestLabelTestName] != "" &&
!(strings.HasSuffix(oldPod.Name, cexecutor.ScraperPodSuffix) || strings.HasSuffix(newPod.Name, cexecutor.ScraperPodSuffix)) &&
oldPod.Labels["job-name"] == newPod.Labels["job-name"] {
s.metrics.IncTestTriggerEventCount(string(testtrigger.ResourcePod), string(testtrigger.CauseEventUpdated), nil)
s.metrics.IncTestTriggerEventCount("", string(testtrigger.ResourcePod), string(testtrigger.CauseEventUpdated), nil)
s.checkExecutionPodStatus(ctx, oldPod.Labels["job-name"], []*corev1.Pod{oldPod, newPod})
}
},
Expand Down

0 comments on commit 9e8a59a

Please sign in to comment.