Skip to content

Commit

Permalink
Merge pull request #279 from leanix/bugfix/HEL-2718_event_per_workload
Browse files Browse the repository at this point in the history
Updated name to be displayed as{workloadType/workloadName}
  • Loading branch information
DennisBerthold-leanix authored May 23, 2023
2 parents 8c5fbb4 + ce26a54 commit 9529444
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/iris/workloads/models/eventsEcst.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func CreateEcstDiscoveryEvent(eventType string, changeAction string, data Data,

body := models.DiscoveryBody{
State: models.State{
Name: data.Workload.ClusterName,
Name: fmt.Sprintf("%s/%s", data.Workload.WorkloadType, data.Workload.WorkloadName),
SourceType: "kubernetes",
SourceInstance: fmt.Sprintf("cluster/%s", data.Workload.ClusterName),
Time: time,
Expand Down
4 changes: 2 additions & 2 deletions pkg/iris/workloads/services/events/eventProducer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func Test_eventProducer_filter_created(t *testing.T) {
assert.NoError(t, err)
assert.Empty(t, updated)
assert.Len(t, created, 1)
assert.Equal(t, "testCluster1", created[0].Body.State.Name)
assert.Equal(t, "deployment/testWorkload1", created[0].Body.State.Name)
}

func Test_eventProducer_filter_updated_no_change(t *testing.T) {
Expand Down Expand Up @@ -394,7 +394,7 @@ func Test_eventProducer_createECSTEvents(t *testing.T) {
assert.Equal(t, hex.EncodeToString(id1[:]), created[0].HeaderProperties.Id)
assert.Equal(t, models.EventTypeChange, created[0].HeaderProperties.Type)
assert.Equal(t, models.EventActionCreated, created[0].HeaderProperties.Action)
assert.Equal(t, "testCluster1", created[0].Body.State.Name)
assert.Equal(t, "deployment/testWorkload1", created[0].Body.State.Name)
// UPDATED
assert.Equal(t, models.EventTypeChange, updated[0].HeaderProperties.Type)
assert.Equal(t, models.EventActionUpdated, updated[0].HeaderProperties.Action)
Expand Down

0 comments on commit 9529444

Please sign in to comment.