@@ -31,9 +31,9 @@ import (
3131)
3232
3333const (
34- configApplyErrorMessage = "failed validating config NGINX config test failed exit status 1:" +
35- " nginx: [emerg] unexpected end of file, expecting \" ;\" or \" }\" in /etc/nginx/nginx.conf:2\n nginx: " +
36- "configuration file /etc/nginx/nginx.conf test failed\n "
34+ // configApplyErrorMessage = "failed validating config NGINX config test failed exit status 1:" +
35+ // " nginx: [emerg] unexpected end of file, expecting \";\" or \"}\" in /etc/nginx/nginx.conf:2\nnginx: " +
36+ // "configuration file /etc/nginx/nginx.conf test failed\n"
3737
3838 retryCount = 5
3939 retryWaitTime = 2 * time .Second
@@ -310,11 +310,11 @@ func TestGrpc_ConfigApply(t *testing.T) {
310310 responses = getManagementPlaneResponses (t , 1 )
311311 t .Logf ("Config apply responses: %v" , responses )
312312
313- //assert.Equal(t, mpi.CommandResponse_COMMAND_STATUS_OK, responses[0].GetCommandResponse().GetStatus())
314- //assert.Equal(t, "Config apply successful", responses[0].GetCommandResponse().GetMessage())
313+ // assert.Equal(t, mpi.CommandResponse_COMMAND_STATUS_OK, responses[0].GetCommandResponse().GetStatus())
314+ // assert.Equal(t, "Config apply successful", responses[0].GetCommandResponse().GetMessage())
315315 })
316316
317- //t.Run("Test 3: Invalid config", func(t *testing.T) {
317+ // t.Run("Test 3: Invalid config", func(t *testing.T) {
318318 // clearManagementPlaneResponses(t)
319319 // err := mockManagementPlaneGrpcContainer.CopyFileToContainer(
320320 // ctx,
@@ -335,9 +335,9 @@ func TestGrpc_ConfigApply(t *testing.T) {
335335 // assert.Equal(t, mpi.CommandResponse_COMMAND_STATUS_FAILURE, responses[1].GetCommandResponse().GetStatus())
336336 // assert.Equal(t, "Config apply failed, rollback successful", responses[1].GetCommandResponse().GetMessage())
337337 // assert.Equal(t, configApplyErrorMessage, responses[1].GetCommandResponse().GetError())
338- //})
338+ // })
339339 //
340- //t.Run("Test 4: File not in allowed directory", func(t *testing.T) {
340+ // t.Run("Test 4: File not in allowed directory", func(t *testing.T) {
341341 // clearManagementPlaneResponses(t)
342342 // performInvalidConfigApply(t, nginxInstanceID)
343343 //
@@ -351,7 +351,7 @@ func TestGrpc_ConfigApply(t *testing.T) {
351351 // "file not in allowed directories /unknown/nginx.conf",
352352 // responses[0].GetCommandResponse().GetError(),
353353 // )
354- //})
354+ // })
355355}
356356
357357func TestGrpc_FileWatcher (t * testing.T ) {
@@ -428,52 +428,52 @@ func performConfigApply(t *testing.T, nginxInstanceID string) {
428428 assert .Equal (t , http .StatusOK , resp .StatusCode ())
429429}
430430
431- func performInvalidConfigApply (t * testing.T , nginxInstanceID string ) {
432- t .Helper ()
433-
434- client := resty .New ()
435- client .SetRetryCount (retryCount ).SetRetryWaitTime (retryWaitTime ).SetRetryMaxWaitTime (retryMaxWaitTime )
436-
437- body := fmt .Sprintf (`{
438- "message_meta": {
439- "message_id": "e2254df9-8edd-4900-91ce-88782473bcb9",
440- "correlation_id": "9673f3b4-bf33-4d98-ade1-ded9266f6818",
441- "timestamp": "2023-01-15T01:30:15.01Z"
442- },
443- "config_apply_request": {
444- "overview": {
445- "files": [{
446- "file_meta": {
447- "name": "/etc/nginx/nginx.conf",
448- "hash": "ea57e443-e968-3a50-b842-f37112acde71",
449- "modifiedTime": "2023-01-15T01:30:15.01Z",
450- "permissions": "0644",
451- "size": 0
452- },
453- "action": "FILE_ACTION_UPDATE"
454- },
455- {
456- "file_meta": {
457- "name": "/unknown/nginx.conf",
458- "hash": "bd1f337d-6874-35ea-9d4d-2b543efd42cf",
459- "modifiedTime": "2023-01-15T01:30:15.01Z",
460- "permissions": "0644",
461- "size": 0
462- },
463- "action": "FILE_ACTION_ADD"
464- }],
465- "config_version": {
466- "instance_id": "%s",
467- "version": "6f343257-55e3-309e-a2eb-bb13af5f80f4"
468- }
469- }
470- }
471- }` , nginxInstanceID )
472- url := fmt .Sprintf ("http://%s/api/v1/requests" , mockManagementPlaneAPIAddress )
473- resp , err := client .R ().EnableTrace ().SetBody (body ).Post (url )
474- require .NoError (t , err )
475- assert .Equal (t , http .StatusOK , resp .StatusCode ())
476- }
431+ // func performInvalidConfigApply(t *testing.T, nginxInstanceID string) {
432+ // t.Helper()
433+ //
434+ // client := resty.New()
435+ // client.SetRetryCount(retryCount).SetRetryWaitTime(retryWaitTime).SetRetryMaxWaitTime(retryMaxWaitTime)
436+ //
437+ // body := fmt.Sprintf(`{
438+ // "message_meta": {
439+ // "message_id": "e2254df9-8edd-4900-91ce-88782473bcb9",
440+ // "correlation_id": "9673f3b4-bf33-4d98-ade1-ded9266f6818",
441+ // "timestamp": "2023-01-15T01:30:15.01Z"
442+ // },
443+ // "config_apply_request": {
444+ // "overview": {
445+ // "files": [{
446+ // "file_meta": {
447+ // "name": "/etc/nginx/nginx.conf",
448+ // "hash": "ea57e443-e968-3a50-b842-f37112acde71",
449+ // "modifiedTime": "2023-01-15T01:30:15.01Z",
450+ // "permissions": "0644",
451+ // "size": 0
452+ // },
453+ // "action": "FILE_ACTION_UPDATE"
454+ // },
455+ // {
456+ // "file_meta": {
457+ // "name": "/unknown/nginx.conf",
458+ // "hash": "bd1f337d-6874-35ea-9d4d-2b543efd42cf",
459+ // "modifiedTime": "2023-01-15T01:30:15.01Z",
460+ // "permissions": "0644",
461+ // "size": 0
462+ // },
463+ // "action": "FILE_ACTION_ADD"
464+ // }],
465+ // "config_version": {
466+ // "instance_id": "%s",
467+ // "version": "6f343257-55e3-309e-a2eb-bb13af5f80f4"
468+ // }
469+ // }
470+ // }
471+ // }`, nginxInstanceID)
472+ // url := fmt.Sprintf("http://%s/api/v1/requests", mockManagementPlaneAPIAddress)
473+ // resp, err := client.R().EnableTrace().SetBody(body).Post(url)
474+ // require.NoError(t, err)
475+ // assert.Equal(t, http.StatusOK, resp.StatusCode())
476+ // }
477477
478478func getManagementPlaneResponses (t * testing.T , numberOfExpectedResponses int ) []* mpi.DataPlaneResponse {
479479 t .Helper ()
0 commit comments