Skip to content

Commit 93c4ea6

Browse files
authored
Revert "Fix deployment failure with CF if password contains special char (#5197)" (#5215)
This reverts commit 8205624. Co-authored-by: Valentin Uchkunev <[email protected]>
1 parent aa1e675 commit 93c4ea6

22 files changed

+158
-234
lines changed

cmd/abapEnvironmentCreateSystem_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func TestRunAbapEnvironmentCreateSystem(t *testing.T) {
3232
err := runAbapEnvironmentCreateSystem(&config, nil, cf, u)
3333
if assert.NoError(t, err) {
3434
assert.Equal(t, []mock.ExecCall{
35-
{Execution: (*mock.Execution)(nil), Async: false, Exec: "cf", Params: []string{"login", "-a", "https://api.endpoint.com", "-o", "testOrg", "-s", "testSpace", "-u", "'testUser'", "-p", "'testPassword'"}},
35+
{Execution: (*mock.Execution)(nil), Async: false, Exec: "cf", Params: []string{"login", "-a", "https://api.endpoint.com", "-o", "testOrg", "-s", "testSpace", "-u", "testUser", "-p", "testPassword"}},
3636
{Execution: (*mock.Execution)(nil), Async: false, Exec: "cf", Params: []string{"create-service", config.CfService, config.CfServicePlan, config.CfServiceInstance, "-c", "{\"is_development_allowed\":false}", "--wait"}},
3737
{Execution: (*mock.Execution)(nil), Async: false, Exec: "cf", Params: []string{"logout"}}},
3838
m.Calls)
@@ -79,7 +79,7 @@ func TestRunAbapEnvironmentCreateSystem(t *testing.T) {
7979
err = runAbapEnvironmentCreateSystem(&config, nil, cf, u)
8080
if assert.NoError(t, err) {
8181
assert.Equal(t, []mock.ExecCall{
82-
{Execution: (*mock.Execution)(nil), Async: false, Exec: "cf", Params: []string{"login", "-a", "https://api.endpoint.com", "-o", "testOrg", "-s", "testSpace", "-u", "'testUser'", "-p", "'testPassword'"}},
82+
{Execution: (*mock.Execution)(nil), Async: false, Exec: "cf", Params: []string{"login", "-a", "https://api.endpoint.com", "-o", "testOrg", "-s", "testSpace", "-u", "testUser", "-p", "testPassword"}},
8383
{Execution: (*mock.Execution)(nil), Async: false, Exec: "cf", Params: []string{"create-service-push", "--no-push", "--service-manifest", "customManifest.yml"}},
8484
{Execution: (*mock.Execution)(nil), Async: false, Exec: "cf", Params: []string{"logout"}}},
8585
m.Calls)

cmd/abapEnvironmentPushATCSystemConfig_test.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ func TestFetchXcsrfTokenFromHead(t *testing.T) {
2828
Password: "Test",
2929
URL: "https://api.endpoint.com/Entity/",
3030
}
31-
token, err := fetchXcsrfTokenFromHead(con, client)
32-
if err == nil {
31+
token, error := fetchXcsrfTokenFromHead(con, client)
32+
if error == nil {
3333
assert.Equal(t, tokenExpected, token)
3434
}
3535
})
@@ -46,8 +46,8 @@ func TestFetchXcsrfTokenFromHead(t *testing.T) {
4646
Password: "Test",
4747
URL: "https://api.endpoint.com/Entity/",
4848
}
49-
token, err := fetchXcsrfTokenFromHead(con, client)
50-
if err == nil {
49+
token, error := fetchXcsrfTokenFromHead(con, client)
50+
if error == nil {
5151
assert.Equal(t, tokenExpected, token)
5252
}
5353
})
@@ -77,39 +77,39 @@ func TestHandleHttpResponse(t *testing.T) {
7777
--B772E21DAA42B9571C778276B829D6C20
7878
Content-Type: multipart/mixed; boundary=B772E21DAA42B9571C778276B829D6C21
7979
Content-Length: 1973
80-
80+
8181
--B772E21DAA42B9571C778276B829D6C21
8282
Content-Type: application/http
8383
Content-Length: 646
8484
content-transfer-encoding: binary
8585
content-id: 1
86-
86+
8787
HTTP/1.1 200 OK
8888
Content-Type: application/json;odata.metadata=minimal;charset=utf-8
8989
Content-Length: 465
9090
odata-version: 4.0
9191
cache-control: no-cache, no-store, must-revalidate
92-
92+
9393
{"@odata.context":"$metadata#configuration/$entity","@odata.metadataEtag":"W/\"20220211135922\"","root_id":"1","conf_id":"aef8f52b-fe16-1edc-a3fe-27a1e0226c7b","conf_name":"Z_CONFIG_VIA_PIPELINE_STEP","checkvariant":"ABAP_CLOUD_DEVELOPMENT_DEFAULT","pseudo_comment_policy":"SP","last_changed_by":"CC0000000017","last_changed_at":"2022-03-02T11:16:51.336172Z","block_findings":"0","inform_findings":"1","transport_check_policy":"C","check_tasks":true,"check_requests":false,"check_tocs":true,"is_default":false,"is_proxy_variant":false,"SAP__Messages":[]}
9494
--B772E21DAA42B9571C778276B829D6C21
9595
Content-Type: application/http
9696
Content-Length: 428
9797
content-transfer-encoding: binary
9898
content-id: 2
99-
99+
100100
HTTP/1.1 200 OK
101101
Content-Type: application/json;odata.metadata=minimal;charset=utf-8
102102
Content-Length: 247
103103
odata-version: 4.0
104104
cache-control: no-cache, no-store, must-revalidate
105-
105+
106106
{"@odata.context":"$metadata#priority/$entity","@odata.metadataEtag":"W/\"20220211135922\"","root_id":"1","conf_id":"aef8f52b-fe16-1edc-a3fe-27a1e0226c7b","test":"CL_CI_ARS_COMPATIBILITY_CHECK","message_id":"010","default_priority":1,"priority":2}
107107
--B772E21DAA42B9571C778276B829D6C21
108108
Content-Type: application/http
109109
Content-Length: 428
110110
content-transfer-encoding: binary
111111
content-id: 3
112-
112+
113113
HTTP/1.1 4** OK
114114
Content-Type: application/json;odata.metadata=minimal;charset=utf-8
115115
Content-Length: 247
@@ -118,7 +118,7 @@ cache-control: no-cache, no-store, must-revalidate
118118
119119
{"Some Error Messages possible in here!"}
120120
--B772E21DAA42B9571C778276B829D6C21--
121-
121+
122122
--B772E21DAA42B9571C778276B829D6C20--`
123123

124124
client := &abaputils.ClientMock{
@@ -150,39 +150,39 @@ cache-control: no-cache, no-store, must-revalidate
150150
--B772E21DAA42B9571C778276B829D6C20
151151
Content-Type: multipart/mixed; boundary=B772E21DAA42B9571C778276B829D6C21
152152
Content-Length: 1973
153-
153+
154154
--B772E21DAA42B9571C778276B829D6C21
155155
Content-Type: application/http
156156
Content-Length: 646
157157
content-transfer-encoding: binary
158158
content-id: 1
159-
159+
160160
HTTP/1.1 200 OK
161161
Content-Type: application/json;odata.metadata=minimal;charset=utf-8
162162
Content-Length: 465
163163
odata-version: 4.0
164164
cache-control: no-cache, no-store, must-revalidate
165-
165+
166166
{"@odata.context":"$metadata#configuration/$entity","@odata.metadataEtag":"W/\"20220211135922\"","root_id":"1","conf_id":"aef8f52b-fe16-1edc-a3fe-27a1e0226c7b","conf_name":"Z_CONFIG_VIA_PIPELINE_STEP","checkvariant":"ABAP_CLOUD_DEVELOPMENT_DEFAULT","pseudo_comment_policy":"SP","last_changed_by":"CC0000000017","last_changed_at":"2022-03-02T11:16:51.336172Z","block_findings":"0","inform_findings":"1","transport_check_policy":"C","check_tasks":true,"check_requests":false,"check_tocs":true,"is_default":false,"is_proxy_variant":false,"SAP__Messages":[]}
167167
--B772E21DAA42B9571C778276B829D6C21
168168
Content-Type: application/http
169169
Content-Length: 428
170170
content-transfer-encoding: binary
171171
content-id: 2
172-
172+
173173
HTTP/1.1 200 OK
174174
Content-Type: application/json;odata.metadata=minimal;charset=utf-8
175175
Content-Length: 247
176176
odata-version: 4.0
177177
cache-control: no-cache, no-store, must-revalidate
178-
178+
179179
{"@odata.context":"$metadata#priority/$entity","@odata.metadataEtag":"W/\"20220211135922\"","root_id":"1","conf_id":"aef8f52b-fe16-1edc-a3fe-27a1e0226c7b","test":"CL_CI_ARS_COMPATIBILITY_CHECK","message_id":"010","default_priority":1,"priority":2}
180180
--B772E21DAA42B9571C778276B829D6C21
181181
Content-Type: application/http
182182
Content-Length: 428
183183
content-transfer-encoding: binary
184184
content-id: 3
185-
185+
186186
HTTP/1.1 200 OK
187187
Content-Type: application/json;odata.metadata=minimal;charset=utf-8
188188
Content-Length: 247
@@ -191,7 +191,7 @@ cache-control: no-cache, no-store, must-revalidate
191191
192192
{"@odata.context":"$metadata#priority/$entity","@odata.metadataEtag":"W/\"20220211135922\"","root_id":"1","conf_id":"aef8f52b-fe16-1edc-a3fe-27a1e0226c7b","test":"CL_CI_ARS_COMPATIBILITY_CHECK","message_id":"011","default_priority":2,"priority":1}
193193
--B772E21DAA42B9571C778276B829D6C21--
194-
194+
195195
--B772E21DAA42B9571C778276B829D6C20--`
196196

197197
client := &abaputils.ClientMock{
@@ -328,7 +328,7 @@ Content-Type: application/json
328328
"transport_check_policy": "C",
329329
"check_tasks": true,
330330
"check_requests": false,
331-
"check_tocs": true,
331+
"check_tocs": true,
332332
"_priorities": [
333333
{
334334
"test": "CL_CI_TEST_AMDP_HDB_MIGRATION",

cmd/abapEnvironmentRunATCCheck_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ func TestHostConfig(t *testing.T) {
2929
Exec: execRunner,
3030
}
3131
var con abaputils.ConnectionDetailsHTTP
32-
con, err := autils.GetAbapCommunicationArrangementInfo(options.AbapEnvOptions, "")
32+
con, error := autils.GetAbapCommunicationArrangementInfo(options.AbapEnvOptions, "")
3333

34-
if err == nil {
34+
if error == nil {
3535
assert.Equal(t, "testUser", con.User)
3636
assert.Equal(t, "testPassword", con.Password)
3737
assert.Equal(t, "https://api.endpoint.com", con.URL)
@@ -82,8 +82,8 @@ func TestHostConfig(t *testing.T) {
8282
Exec: execRunner,
8383
}
8484
var con abaputils.ConnectionDetailsHTTP
85-
con, err := autils.GetAbapCommunicationArrangementInfo(options.AbapEnvOptions, "")
86-
if err == nil {
85+
con, error := autils.GetAbapCommunicationArrangementInfo(options.AbapEnvOptions, "")
86+
if error == nil {
8787
assert.Equal(t, "", con.User)
8888
assert.Equal(t, "", con.Password)
8989
assert.Equal(t, "", con.URL)
@@ -106,8 +106,8 @@ func TestATCTrigger(t *testing.T) {
106106
Password: "Test",
107107
URL: "https://api.endpoint.com/Entity/",
108108
}
109-
resp, err := runATC("GET", con, []byte(client.Body), client)
110-
if err == nil {
109+
resp, error := runATC("GET", con, []byte(client.Body), client)
110+
if error == nil {
111111
assert.Equal(t, tokenExpected, resp.Header["X-Csrf-Token"][0])
112112
assert.Equal(t, int64(0), resp.ContentLength)
113113
assert.Equal(t, []string([]string(nil)), resp.Header["Location"])
@@ -129,8 +129,8 @@ func TestFetchXcsrfToken(t *testing.T) {
129129
Password: "Test",
130130
URL: "https://api.endpoint.com/Entity/",
131131
}
132-
token, err := fetchXcsrfToken("GET", con, []byte(client.Body), client)
133-
if err == nil {
132+
token, error := fetchXcsrfToken("GET", con, []byte(client.Body), client)
133+
if error == nil {
134134
assert.Equal(t, tokenExpected, token)
135135
}
136136
})
@@ -147,8 +147,8 @@ func TestFetchXcsrfToken(t *testing.T) {
147147
Password: "Test",
148148
URL: "https://api.endpoint.com/Entity/",
149149
}
150-
token, err := fetchXcsrfToken("GET", con, []byte(client.Body), client)
151-
if err == nil {
150+
token, error := fetchXcsrfToken("GET", con, []byte(client.Body), client)
151+
if error == nil {
152152
assert.Equal(t, tokenExpected, token)
153153
}
154154
})

cmd/abapEnvironmentRunAUnitTest_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,8 @@ func TestRunAbapEnvironmentRunAUnitTest(t *testing.T) {
582582
Password: "Test",
583583
URL: "https://api.endpoint.com/Entity/",
584584
}
585-
token, err := fetchAUnitXcsrfToken("GET", con, []byte(client.Body), client)
586-
if assert.Equal(t, nil, err) {
585+
token, error := fetchAUnitXcsrfToken("GET", con, []byte(client.Body), client)
586+
if assert.Equal(t, nil, error) {
587587
assert.Equal(t, tokenExpected, token)
588588
}
589589
})
@@ -603,8 +603,8 @@ func TestRunAbapEnvironmentRunAUnitTest(t *testing.T) {
603603
Password: "Test",
604604
URL: "https://api.endpoint.com/Entity/",
605605
}
606-
token, err := fetchAUnitXcsrfToken("GET", con, []byte(client.Body), client)
607-
if assert.Equal(t, nil, err) {
606+
token, error := fetchAUnitXcsrfToken("GET", con, []byte(client.Body), client)
607+
if assert.Equal(t, nil, error) {
608608
assert.Equal(t, tokenExpected, token)
609609
}
610610
})

cmd/abapLandscapePortalUpdateAddOnProduct_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build unit
2-
31
package cmd
42

53
import (

cmd/cloudFoundryCreateServiceKey_test.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//go:build unit
2+
// +build unit
23

34
package cmd
45

@@ -29,8 +30,8 @@ func TestCloudFoundryCreateServiceKey(t *testing.T) {
2930
cfUtilsMock := cloudfoundry.CfUtilsMock{}
3031
defer cfUtilsMock.Cleanup()
3132

32-
err := runCloudFoundryCreateServiceKey(&config, &telemetryData, &execRunner, &cfUtilsMock)
33-
if err == nil {
33+
error := runCloudFoundryCreateServiceKey(&config, &telemetryData, &execRunner, &cfUtilsMock)
34+
if error == nil {
3435
assert.Equal(t, "cf", execRunner.Calls[0].Exec)
3536
assert.Equal(t, []string{"create-service-key", "testInstance", "testKey"}, execRunner.Calls[0].Params)
3637
}
@@ -51,7 +52,8 @@ func TestCloudFoundryCreateServiceKey(t *testing.T) {
5152
cfUtilsMock := cloudfoundry.CfUtilsMock{}
5253
defer cfUtilsMock.Cleanup()
5354

54-
if err := runCloudFoundryCreateServiceKey(&config, &telemetryData, &execRunner, &cfUtilsMock); err == nil {
55+
error := runCloudFoundryCreateServiceKey(&config, &telemetryData, &execRunner, &cfUtilsMock)
56+
if error == nil {
5557
assert.Equal(t, "cf", execRunner.Calls[0].Exec)
5658
assert.Equal(t, []string{"create-service-key", "testInstance", "testKey", "-c", "testconfig.yml"}, execRunner.Calls[0].Params)
5759
}
@@ -72,7 +74,8 @@ func TestCloudFoundryCreateServiceKey(t *testing.T) {
7274
cfUtilsMock := cloudfoundry.CfUtilsMock{}
7375
defer cfUtilsMock.Cleanup()
7476

75-
if err := runCloudFoundryCreateServiceKey(&config, &telemetryData, &execRunner, &cfUtilsMock); err == nil {
77+
error := runCloudFoundryCreateServiceKey(&config, &telemetryData, &execRunner, &cfUtilsMock)
78+
if error == nil {
7679
assert.Equal(t, "cf", execRunner.Calls[0].Exec)
7780
assert.Equal(t, []string{"create-service-key", "testInstance", "testKey", "-c", "{\"scenario_id\":\"SAP_COM_0510\",\"type\":\"basic\"}", cfCliSynchronousRequestFlag}, execRunner.Calls[0].Params)
7881
}
@@ -100,8 +103,8 @@ func TestCloudFoundryCreateServiceKeyErrorMessages(t *testing.T) {
100103
}
101104
defer cfUtilsMock.Cleanup()
102105

103-
err := runCloudFoundryCreateServiceKey(&config, &telemetryData, &execRunner, &cfUtilsMock)
104-
assert.Equal(t, err.Error(), "Error while logging in occurred: "+errorMessage, "Wrong error message")
106+
error := runCloudFoundryCreateServiceKey(&config, &telemetryData, &execRunner, &cfUtilsMock)
107+
assert.Equal(t, error.Error(), "Error while logging in occurred: "+errorMessage, "Wrong error message")
105108
})
106109

107110
t.Run("CF Logout Error", func(t *testing.T) {
@@ -149,7 +152,7 @@ func TestCloudFoundryCreateServiceKeyErrorMessages(t *testing.T) {
149152
}
150153
defer cfUtilsMock.Cleanup()
151154

152-
err := runCloudFoundryCreateServiceKey(&config, &telemetryData, &execRunner, &cfUtilsMock)
153-
assert.Equal(t, err.Error(), "Failed to Create Service Key: "+errorMessage, "Wrong error message")
155+
error := runCloudFoundryCreateServiceKey(&config, &telemetryData, &execRunner, &cfUtilsMock)
156+
assert.Equal(t, error.Error(), "Failed to Create Service Key: "+errorMessage, "Wrong error message")
154157
})
155158
}

0 commit comments

Comments
 (0)