Skip to content

Commit

Permalink
fix: remove typo
Browse files Browse the repository at this point in the history
  • Loading branch information
vsukhin committed Sep 13, 2023
1 parent c8f860a commit e687b67
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
1 change: 1 addition & 0 deletions pkg/event/kind/cdevent/listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func TestCDEventListener_Notify(t *testing.T) {

func exampleExecution() *testkube.Execution {
execution := testkube.NewQueuedExecution()
execution.Id = "1"
execution.Name = "test-1"
execution.TestName = "test"
execution.TestNamespace = "testkube"
Expand Down
22 changes: 11 additions & 11 deletions pkg/mapper/cdevents/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func MapTestkubeEventQueuedTestToCDEvent(event testkube.Event, clusterID, defaul
}

if event.TestExecution != nil {
ev.SetSubjectId(event.TestExecution.Name)
ev.SetSubjectId(event.TestExecution.Id)
}

ev.SetSubjectSource(clusterID)
Expand All @@ -49,7 +49,7 @@ func MapTestkubeEventQueuedTestToCDEvent(event testkube.Event, clusterID, defaul
ev.SetSubjectTestCase(&cdevents.TestCaseRunQueuedSubjectContentTestCase{
Id: event.TestExecution.TestName,
Type: MapTestkubeTestTypeToCDEventTestCaseType(event.TestExecution.TestType),
Uri: fmt.Sprintf("%s/tests/executions/%s", dashboardURI, event.TestExecution.TestName),
Uri: fmt.Sprintf("%s/tests/%s", dashboardURI, event.TestExecution.TestName),
})

namespace := event.TestExecution.TestNamespace
Expand Down Expand Up @@ -88,7 +88,7 @@ func MapTestkubeEventStartTestToCDEvent(event testkube.Event, clusterID, default
}

if event.TestExecution != nil {
ev.SetSubjectId(event.TestExecution.Name)
ev.SetSubjectId(event.TestExecution.Id)
}

ev.SetSubjectSource(clusterID)
Expand All @@ -97,7 +97,7 @@ func MapTestkubeEventStartTestToCDEvent(event testkube.Event, clusterID, default
ev.SetSubjectTestCase(&cdevents.TestCaseRunStartedSubjectContentTestCase{
Id: event.TestExecution.TestName,
Type: MapTestkubeTestTypeToCDEventTestCaseType(event.TestExecution.TestType),
Uri: fmt.Sprintf("%s/tests/executions/%s", dashboardURI, event.TestExecution.TestName),
Uri: fmt.Sprintf("%s/tests/%s", dashboardURI, event.TestExecution.TestName),
})

namespace := event.TestExecution.TestNamespace
Expand Down Expand Up @@ -136,7 +136,7 @@ func MapTestkubeEventFinishTestToCDEvent(event testkube.Event, clusterID, defaul
}

if event.TestExecution != nil {
ev.SetSubjectId(event.TestExecution.Name)
ev.SetSubjectId(event.TestExecution.Id)
}

ev.SetSubjectSource(clusterID)
Expand All @@ -145,7 +145,7 @@ func MapTestkubeEventFinishTestToCDEvent(event testkube.Event, clusterID, defaul
ev.SetSubjectTestCase(&cdevents.TestCaseRunFinishedSubjectContentTestCase{
Id: event.TestExecution.TestName,
Type: MapTestkubeTestTypeToCDEventTestCaseType(event.TestExecution.TestType),
Uri: fmt.Sprintf("%s/tests/executions/%s", dashboardURI, event.TestExecution.TestName),
Uri: fmt.Sprintf("%s/tests/%s", dashboardURI, event.TestExecution.TestName),
})

namespace := event.TestExecution.TestNamespace
Expand Down Expand Up @@ -219,7 +219,7 @@ func MapTestkubeEventQueuedTestSuiteToCDEvent(event testkube.Event, clusterID, d
}

if event.TestSuiteExecution != nil {
ev.SetSubjectId(event.TestSuiteExecution.Name)
ev.SetSubjectId(event.TestSuiteExecution.Id)
}

ev.SetSubjectSource(clusterID)
Expand Down Expand Up @@ -256,7 +256,7 @@ func MapTestkubeEventStartTestSuiteToCDEvent(event testkube.Event, clusterID, da
}

if event.TestSuiteExecution != nil {
ev.SetSubjectId(event.TestSuiteExecution.Name)
ev.SetSubjectId(event.TestSuiteExecution.Id)
}

ev.SetSubjectSource(clusterID)
Expand All @@ -265,7 +265,7 @@ func MapTestkubeEventStartTestSuiteToCDEvent(event testkube.Event, clusterID, da
if event.TestSuiteExecution.TestSuite != nil {
ev.SetSubjectTestSuite(&cdevents.TestSuiteRunStartedSubjectContentTestSuite{
Id: event.TestSuiteExecution.TestSuite.Name,
Uri: fmt.Sprintf("%s/test-suites/executions/%s", dashboardURI, event.TestSuiteExecution.TestSuite.Name),
Uri: fmt.Sprintf("%s/test-suites/%s", dashboardURI, event.TestSuiteExecution.TestSuite.Name),
})

ev.SetSubjectEnvironment(&cdevents.Reference{
Expand Down Expand Up @@ -293,7 +293,7 @@ func MapTestkubeEventFinishTestSuiteToCDEvent(event testkube.Event, clusterID, d
}

if event.TestSuiteExecution != nil {
ev.SetSubjectId(event.TestSuiteExecution.Name)
ev.SetSubjectId(event.TestSuiteExecution.Id)
}

ev.SetSubjectSource(clusterID)
Expand All @@ -302,7 +302,7 @@ func MapTestkubeEventFinishTestSuiteToCDEvent(event testkube.Event, clusterID, d
if event.TestSuiteExecution.TestSuite != nil {
ev.SetSubjectTestSuite(&cdevents.TestSuiteRunFinishedSubjectContentTestSuite{
Id: event.TestSuiteExecution.TestSuite.Name,
Uri: fmt.Sprintf("%s/test-suites/executions/%s", dashboardURI, event.TestSuiteExecution.TestSuite.Name),
Uri: fmt.Sprintf("%s/test-suites/%s", dashboardURI, event.TestSuiteExecution.TestSuite.Name),
})

ev.SetSubjectEnvironment(&cdevents.Reference{
Expand Down
28 changes: 17 additions & 11 deletions pkg/mapper/cdevents/mapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func TestMapTestkubeEventQueuedTestToCDEvent(t *testing.T) {

event := testkube.Event{
TestExecution: &testkube.Execution{
Id: "1",
Name: "test-1",
TestName: "Test 1",
TestType: "ginkgo/test",
Expand All @@ -35,7 +36,7 @@ func TestMapTestkubeEventQueuedTestToCDEvent(t *testing.T) {
}

subjectID := ev.GetSubjectId()
if subjectID != "test-1" {
if subjectID != "1" {
t.Errorf("Unexpected subject ID: %s", subjectID)
}

Expand Down Expand Up @@ -63,7 +64,7 @@ func TestMapTestkubeEventQueuedTestToCDEvent(t *testing.T) {
}

testURI := cde.Subject.Content.TestCase.Uri
if testURI != "/tests/executions/Test 1" {
if testURI != "/tests/Test 1" {
t.Errorf("Unexpected test case uri: %s", testURI)
}

Expand Down Expand Up @@ -98,6 +99,7 @@ func TestMapTestkubeEventStatTestToCDEvent(t *testing.T) {

event := testkube.Event{
TestExecution: &testkube.Execution{
Id: "1",
Name: "test-1",
TestName: "Test 1",
TestType: "ginkgo/test",
Expand All @@ -118,7 +120,7 @@ func TestMapTestkubeEventStatTestToCDEvent(t *testing.T) {
}

subjectID := ev.GetSubjectId()
if subjectID != "test-1" {
if subjectID != "1" {
t.Errorf("Unexpected subject ID: %s", subjectID)
}

Expand Down Expand Up @@ -146,7 +148,7 @@ func TestMapTestkubeEventStatTestToCDEvent(t *testing.T) {
}

testURI := cde.Subject.Content.TestCase.Uri
if testURI != "/tests/executions/Test 1" {
if testURI != "/tests/Test 1" {
t.Errorf("Unexpected test case uri: %s", testURI)
}

Expand Down Expand Up @@ -182,6 +184,7 @@ func TestMapTestkubeEventFinishTestToCDEvent(t *testing.T) {
result := testkube.NewErrorExecutionResult(errors.New("fake"))
event := testkube.Event{
TestExecution: &testkube.Execution{
Id: "1",
Name: "test-1",
TestName: "Test 1",
TestType: "ginkgo/test",
Expand All @@ -203,7 +206,7 @@ func TestMapTestkubeEventFinishTestToCDEvent(t *testing.T) {
}

subjectID := ev.GetSubjectId()
if subjectID != "test-1" {
if subjectID != "1" {
t.Errorf("Unexpected subject ID: %s", subjectID)
}

Expand Down Expand Up @@ -231,7 +234,7 @@ func TestMapTestkubeEventFinishTestToCDEvent(t *testing.T) {
}

testURI := cde.Subject.Content.TestCase.Uri
if testURI != "/tests/executions/Test 1" {
if testURI != "/tests/Test 1" {
t.Errorf("Unexpected test case uri: %s", testURI)
}

Expand Down Expand Up @@ -271,6 +274,7 @@ func TestMapTestkubeEventQueuedTestSuiteToCDEvent(t *testing.T) {

event := testkube.Event{
TestSuiteExecution: &testkube.TestSuiteExecution{
Id: "1",
Name: "suite-1",
TestSuite: &testkube.ObjectRef{
Namespace: "default",
Expand All @@ -290,7 +294,7 @@ func TestMapTestkubeEventQueuedTestSuiteToCDEvent(t *testing.T) {
}

subjectID := ev.GetSubjectId()
if subjectID != "suite-1" {
if subjectID != "1" {
t.Errorf("Unexpected subject ID: %s", subjectID)
}

Expand Down Expand Up @@ -338,6 +342,7 @@ func TestMapTestkubeEventStartTestSuiteToCDEvent(t *testing.T) {

event := testkube.Event{
TestSuiteExecution: &testkube.TestSuiteExecution{
Id: "1",
Name: "suite-1",
TestSuite: &testkube.ObjectRef{
Namespace: "default",
Expand All @@ -357,7 +362,7 @@ func TestMapTestkubeEventStartTestSuiteToCDEvent(t *testing.T) {
}

subjectID := ev.GetSubjectId()
if subjectID != "suite-1" {
if subjectID != "1" {
t.Errorf("Unexpected subject ID: %s", subjectID)
}

Expand All @@ -380,7 +385,7 @@ func TestMapTestkubeEventStartTestSuiteToCDEvent(t *testing.T) {
}

suiteURI := cde.Subject.Content.TestSuite.Uri
if suiteURI != "/test-suites/executions/Suite 1" {
if suiteURI != "/test-suites/Suite 1" {
t.Errorf("Unexpected test case uri: %s", suiteURI)
}

Expand All @@ -406,6 +411,7 @@ func TestMapTestkubeEventFinishTestSuiteToCDEvent(t *testing.T) {
execution := testkube.NewFailedExecution(errors.New("fake"))
event := testkube.Event{
TestSuiteExecution: &testkube.TestSuiteExecution{
Id: "1",
Name: "suite-1",
TestSuite: &testkube.ObjectRef{
Namespace: "default",
Expand Down Expand Up @@ -435,7 +441,7 @@ func TestMapTestkubeEventFinishTestSuiteToCDEvent(t *testing.T) {
}

subjectID := ev.GetSubjectId()
if subjectID != "suite-1" {
if subjectID != "1" {
t.Errorf("Unexpected subject ID: %s", subjectID)
}

Expand All @@ -458,7 +464,7 @@ func TestMapTestkubeEventFinishTestSuiteToCDEvent(t *testing.T) {
}

suiteURI := cde.Subject.Content.TestSuite.Uri
if suiteURI != "/test-suites/executions/Suite 1" {
if suiteURI != "/test-suites/Suite 1" {
t.Errorf("Unexpected test case uri: %s", suiteURI)
}

Expand Down

0 comments on commit e687b67

Please sign in to comment.