Skip to content
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

SAP_COM_0948 #4715

Merged
merged 12 commits into from
Dec 19, 2023
12 changes: 6 additions & 6 deletions cmd/abapEnvironmentCheckoutBranch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestCheckoutBranchStep(t *testing.T) {
StatusCode: 200,
}

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Microsecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err := runAbapEnvironmentCheckoutBranch(&config, &autils, apiManager)
assert.NoError(t, err, "Did not expect error")
})
Expand Down Expand Up @@ -96,7 +96,7 @@ func TestCheckoutBranchStep(t *testing.T) {
StatusCode: 200,
}

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Microsecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err := runAbapEnvironmentCheckoutBranch(&config, &autils, apiManager)
assert.EqualError(t, err, expectedErrorMessage)
})
Expand Down Expand Up @@ -135,7 +135,7 @@ func TestCheckoutBranchStep(t *testing.T) {
StatusCode: 200,
}

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Microsecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err := runAbapEnvironmentCheckoutBranch(&config, &autils, apiManager)
assert.EqualError(t, err, expectedErrorMessage)
})
Expand Down Expand Up @@ -184,7 +184,7 @@ repositories:
Password: "testPassword",
Repositories: "repositoriesTest.yml",
}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Microsecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err = runAbapEnvironmentCheckoutBranch(&config, &autils, apiManager)
assert.NoError(t, err)
})
Expand Down Expand Up @@ -228,7 +228,7 @@ repositories:
Password: "testPassword",
Repositories: "repositoriesTest.yml",
}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Microsecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err = runAbapEnvironmentCheckoutBranch(&config, &autils, apiManager)
assert.EqualError(t, err, expectedErrorMessage)
})
Expand Down Expand Up @@ -277,7 +277,7 @@ repositories:
Password: "testPassword",
Repositories: "repositoriesTest.yml",
}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Microsecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err = runAbapEnvironmentCheckoutBranch(&config, &autils, apiManager)
assert.EqualError(t, err, expectedErrorMessage)
})
Expand Down
20 changes: 10 additions & 10 deletions cmd/abapEnvironmentCloneGitRepo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ repositories:
Token: "myToken",
}

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err = runAbapEnvironmentCloneGitRepo(&config, &autils, apiManager)
assert.NoError(t, err, "Did not expect error")
assert.Equal(t, 0, len(client.BodyList), "Not all requests were done")
Expand Down Expand Up @@ -140,7 +140,7 @@ repositories:
StatusCode: 200,
}

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err := runAbapEnvironmentCloneGitRepo(&config, &autils, apiManager)
assert.NoError(t, err, "Did not expect error")
assert.Equal(t, 0, len(client.BodyList), "Not all requests were done")
Expand Down Expand Up @@ -177,7 +177,7 @@ repositories:
StatusCode: 200,
}

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err := runAbapEnvironmentCloneGitRepo(&config, &autils, apiManager)
if assert.Error(t, err, "Expected error") {
assert.Equal(t, "Clone of repository / software component 'testRepo1', branch 'testBranch1' failed on the ABAP system: Request to ABAP System not successful", err.Error(), "Expected different error message")
Expand Down Expand Up @@ -239,7 +239,7 @@ repositories:
Token: "myToken",
StatusCode: 200,
}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err = runAbapEnvironmentCloneGitRepo(&config, &autils, apiManager)
if assert.Error(t, err, "Expected error") {
assert.Equal(t, "Clone of repository / software component '/DMO/REPO_A', branch 'branchA', commit 'ABCD1234' failed on the ABAP system: Request to ABAP System not successful", err.Error(), "Expected different error message")
Expand Down Expand Up @@ -275,7 +275,7 @@ repositories:
Token: "myToken",
StatusCode: 200,
}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err := runAbapEnvironmentCloneGitRepo(&config, &autils, apiManager)
if assert.Error(t, err, "Expected error") {
assert.Equal(t, "Clone of repository / software component 'testRepo1', branch 'testBranch1' failed on the ABAP system: Request to ABAP System not successful", err.Error(), "Expected different error message")
Expand Down Expand Up @@ -310,7 +310,7 @@ repositories:
Token: "myToken",
StatusCode: 200,
}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err := runAbapEnvironmentCloneGitRepo(&config, &autils, apiManager)
if assert.Error(t, err, "Expected error") {
assert.Equal(t, "Clone of repository / software component 'testRepo1', branch 'testBranch1' failed on the ABAP system: Request to ABAP System not successful", err.Error(), "Expected different error message")
Expand Down Expand Up @@ -344,7 +344,7 @@ repositories:
Token: "myToken",
StatusCode: 200,
}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err := runAbapEnvironmentCloneGitRepo(&config, &autils, apiManager)
if assert.Error(t, err, "Expected error") {
assert.Equal(t, "Could not read repositories: Could not find filename.yaml", err.Error(), "Expected different error message")
Expand Down Expand Up @@ -385,7 +385,7 @@ repositories:
Token: "myToken",
StatusCode: 200,
}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err := runAbapEnvironmentCloneGitRepo(&config, &autils, apiManager)
if assert.Error(t, err, "Expected error") {
assert.Equal(t, "The provided configuration is not allowed: It is not allowed to configure the parameters `repositories`and `repositoryName` at the same time", err.Error(), "Expected different error message")
Expand Down Expand Up @@ -441,7 +441,7 @@ func TestALreadyCloned(t *testing.T) {
CommitID: "abcd1234",
}

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err := cloneSingleRepo(apiManager, autils.ReturnedConnectionDetailsHTTP, repo, &config, &autils)
assert.NoError(t, err, "Did not expect error")
})
Expand Down Expand Up @@ -487,7 +487,7 @@ func TestALreadyCloned(t *testing.T) {
CommitID: "abcd1234",
}

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err := cloneSingleRepo(apiManager, autils.ReturnedConnectionDetailsHTTP, repo, &config, &autils)
assert.NoError(t, err, "Did not expect error")
})
Expand Down
50 changes: 25 additions & 25 deletions cmd/abapEnvironmentCreateTag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ repositories:
}
client := &abaputils.ClientMock{
BodyList: []string{
`{"d" : ` + executionLogStringClone + `}`,
`{"d" : ` + executionLogStringCreateTag + `}`,
logResultSuccess,
`{"d" : { "Status" : "S" } }`,
`{"d" : { "uuid" : "abc" } }`,
`{"d" : ` + executionLogStringClone + `}`,
`{"d" : ` + executionLogStringCreateTag + `}`,
logResultSuccess,
`{"d" : { "Status" : "S" } }`,
`{"d" : { "uuid" : "abc" } }`,
`{"d" : ` + executionLogStringClone + `}`,
`{"d" : ` + executionLogStringCreateTag + `}`,
logResultSuccess,
`{"d" : { "Status" : "S" } }`,
`{"d" : { "uuid" : "abc" } }`,
Expand All @@ -101,14 +101,14 @@ repositories:
_, hook := test.NewNullLogger()
log.RegisterHook(hook)

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Microsecond}
apiManager := &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err = runAbapEnvironmentCreateTag(config, autils, apiManager)

assert.NoError(t, err, "Did not expect error")
assert.Equal(t, 22, len(hook.Entries), "Expected a different number of entries")
assert.Equal(t, `Created tag v4.5.6 for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[11].Message, "Expected a different message")
assert.Equal(t, `Created tag -DMO-PRODUCT-1.2.3 for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[16].Message, "Expected a different message")
assert.Equal(t, `Created tag tag for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[21].Message, "Expected a different message")
assert.Equal(t, 25, len(hook.Entries), "Expected a different number of entries")
assert.Equal(t, `Created tag v4.5.6 for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[12].Message, "Expected a different message")
assert.Equal(t, `Created tag -DMO-PRODUCT-1.2.3 for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[18].Message, "Expected a different message")
assert.Equal(t, `Created tag tag for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[24].Message, "Expected a different message")
hook.Reset()
})

Expand Down Expand Up @@ -153,17 +153,17 @@ repositories:
}
client := &abaputils.ClientMock{
BodyList: []string{
`{"d" : ` + executionLogStringClone + `}`,
`{"d" : ` + executionLogStringCreateTag + `}`,
logResultSuccess,
`{"d" : { "Status" : "E" } }`,
`{"d" : { "uuid" : "abc" } }`,
`{"d" : { "empty" : "body" } }`,
`{"d" : ` + executionLogStringClone + `}`,
`{"d" : ` + executionLogStringCreateTag + `}`,
logResultSuccess,
`{"d" : { "Status" : "E" } }`,
`{"d" : { "uuid" : "abc" } }`,
`{"d" : { "empty" : "body" } }`,
`{"d" : ` + executionLogStringClone + `}`,
`{"d" : ` + executionLogStringCreateTag + `}`,
logResultSuccess,
`{"d" : { "Status" : "E" } }`,
`{"d" : { "uuid" : "abc" } }`,
Expand All @@ -176,15 +176,15 @@ repositories:
_, hook := test.NewNullLogger()
log.RegisterHook(hook)

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Microsecond}
apiManager := &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err = runAbapEnvironmentCreateTag(config, autils, apiManager)

assert.Error(t, err, "Did expect error")
assert.Equal(t, 37, len(hook.Entries), "Expected a different number of entries")
assert.Equal(t, `NOT created: Tag v4.5.6 for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[11].Message, "Expected a different message")
assert.Equal(t, `NOT created: Tag -DMO-PRODUCT-1.2.3 for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[23].Message, "Expected a different message")
assert.Equal(t, `NOT created: Tag tag for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[35].Message, "Expected a different message")
assert.Equal(t, `At least one tag has not been created`, hook.AllEntries()[36].Message, "Expected a different message")
assert.Equal(t, 40, len(hook.Entries), "Expected a different number of entries")
assert.Equal(t, `NOT created: Tag v4.5.6 for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[12].Message, "Expected a different message")
assert.Equal(t, `NOT created: Tag -DMO-PRODUCT-1.2.3 for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[25].Message, "Expected a different message")
assert.Equal(t, `NOT created: Tag tag for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[38].Message, "Expected a different message")
assert.Equal(t, `At least one tag has not been created`, hook.AllEntries()[39].Message, "Expected a different message")
hook.Reset()

})
Expand Down Expand Up @@ -215,7 +215,7 @@ func TestRunAbapEnvironmentCreateTagConfigurations(t *testing.T) {
}
client := &abaputils.ClientMock{
BodyList: []string{
`{"d" : ` + executionLogStringClone + `}`,
`{"d" : ` + executionLogStringCreateTag + `}`,
logResultSuccess,
`{"d" : { "Status" : "S" } }`,
`{"d" : { "uuid" : "abc" } }`,
Expand All @@ -228,12 +228,12 @@ func TestRunAbapEnvironmentCreateTagConfigurations(t *testing.T) {
_, hook := test.NewNullLogger()
log.RegisterHook(hook)

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Microsecond}
apiManager := &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err := runAbapEnvironmentCreateTag(config, autils, apiManager)

assert.NoError(t, err, "Did not expect error")
assert.Equal(t, 12, len(hook.Entries), "Expected a different number of entries")
assert.Equal(t, `Created tag tag for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[11].Message, "Expected a different message")
assert.Equal(t, 13, len(hook.Entries), "Expected a different number of entries")
assert.Equal(t, `Created tag tag for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[12].Message, "Expected a different message")
hook.Reset()
})

Expand Down Expand Up @@ -296,7 +296,7 @@ repositories:
StatusCode: 200,
}

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Microsecond}
apiManager := &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err = runAbapEnvironmentCreateTag(config, autils, apiManager)

assert.Error(t, err, "Did expect error")
Expand Down Expand Up @@ -359,12 +359,12 @@ repositories:
_, hook := test.NewNullLogger()
log.RegisterHook(hook)

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Microsecond}
apiManager := &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err = runAbapEnvironmentCreateTag(config, autils, apiManager)

assert.NoError(t, err, "Did not expect error")
assert.Equal(t, 5, len(hook.Entries), "Expected a different number of entries")
assert.Equal(t, `Created tag tag for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[4].Message, "Expected a different message")
assert.Equal(t, 6, len(hook.Entries), "Expected a different number of entries")
assert.Equal(t, `Created tag tag for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[5].Message, "Expected a different message")
hook.Reset()

})
Expand Down
Loading
Loading