Skip to content

Commit

Permalink
Enable compatibility for old tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMieg committed Dec 6, 2023
1 parent a67cfa9 commit 83af71f
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 54 deletions.
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
10 changes: 5 additions & 5 deletions cmd/abapEnvironmentCreateTag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ 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")
Expand Down Expand Up @@ -176,7 +176,7 @@ 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")
Expand Down Expand Up @@ -228,7 +228,7 @@ 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")
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,7 +359,7 @@ 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")
Expand Down
18 changes: 9 additions & 9 deletions cmd/abapEnvironmentPullGitRepo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestPullStep(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 := runAbapEnvironmentPullGitRepo(&config, &autils, apiManager)
assert.NoError(t, err, "Did not expect error")
assert.Equal(t, 0, len(client.BodyList), "Not all requests were done")
Expand All @@ -96,7 +96,7 @@ func TestPullStep(t *testing.T) {

config := abapEnvironmentPullGitRepoOptions{}

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Microsecond}
apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err := runAbapEnvironmentPullGitRepo(&config, &autils, apiManager)
assert.Equal(t, expectedErrorMessage, err.Error(), "Different error message expected")
})
Expand Down Expand Up @@ -147,7 +147,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 = runAbapEnvironmentPullGitRepo(&config, &autils, apiManager)
assert.NoError(t, err)
})
Expand Down Expand Up @@ -203,7 +203,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 = runAbapEnvironmentPullGitRepo(&config, &autils, apiManager)
if assert.Error(t, err, "Expected error") {
assert.Equal(t, "Pull of the repository / software component '/DMO/REPO_A', commit 'ABCD1234' failed on the ABAP system", err.Error(), "Expected different error message")
Expand Down Expand Up @@ -262,7 +262,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 = runAbapEnvironmentPullGitRepo(&config, &autils, apiManager)
if assert.Error(t, err, "Expected error") {
assert.Equal(t, "Pull of the repository / software component '/DMO/REPO_A', tag 'v-1.0.1-build-0001' failed on the ABAP system", err.Error(), "Expected different error message")
Expand Down Expand Up @@ -302,7 +302,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 := runAbapEnvironmentPullGitRepo(&config, &autils, apiManager)
if assert.Error(t, err, "Expected error") {
assert.Equal(t, "Pull of the repository / software component '/DMO/SWC', commit '123456' failed on the ABAP system", err.Error(), "Expected different error message")
Expand Down Expand Up @@ -341,7 +341,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 := runAbapEnvironmentPullGitRepo(&config, &autils, apiManager)
if assert.Error(t, err, "Expected error") {
assert.Equal(t, "Pull of the repository / software component '/DMO/SWC' failed on the ABAP system", err.Error(), "Expected different error message")
Expand Down Expand Up @@ -388,7 +388,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 = runAbapEnvironmentPullGitRepo(&config, &autils, apiManager)
assert.EqualError(t, err, expectedErrorMessage)
})
Expand Down Expand Up @@ -438,7 +438,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 = runAbapEnvironmentPullGitRepo(&config, &autils, apiManager)
assert.EqualError(t, err, expectedErrorMessage)
})
Expand Down
4 changes: 2 additions & 2 deletions pkg/abaputils/manageGitRepositoryUtils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestPollEntity(t *testing.T) {
XCsrfToken: "MY_TOKEN",
}

swcManager := SoftwareComponentApiManager{Client: client}
swcManager := SoftwareComponentApiManager{Client: client, Force0510: true}
repo := Repository{Name: "testRepo1"}
api, _ := swcManager.GetAPI(con, repo)

Expand Down Expand Up @@ -91,7 +91,7 @@ func TestPollEntity(t *testing.T) {
XCsrfToken: "MY_TOKEN",
}

swcManager := SoftwareComponentApiManager{Client: client}
swcManager := SoftwareComponentApiManager{Client: client, Force0510: true}
repo := Repository{Name: "testRepo1"}
api, _ := swcManager.GetAPI(con, repo)

Expand Down
Loading

0 comments on commit 83af71f

Please sign in to comment.