Skip to content

Commit db8c825

Browse files
committed
fix failing test case
1 parent 094d943 commit db8c825

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

test/integration/managementplane/config_apply_unreferenced_files_test.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const unrefConfigApplyRequestBody = `{
2525
{
2626
"file_meta": {
2727
"name": "/etc/nginx/test/unreferenced_file.conf",
28-
"permissions": "0644"
28+
"permissions": "0600"
2929
}
3030
}
3131
]
@@ -70,7 +70,7 @@ func (s *ConfigApplyUnreferencedFilesTestSuite) TestConfigApply_Test1_TestSubDir
7070
s.ctx,
7171
"configs/unreferenced_file.conf",
7272
fmt.Sprintf("/mock-management-plane-grpc/config/%s/etc/nginx/test/unreferenced_file.conf", s.nginxInstanceID),
73-
0o666,
73+
0o600,
7474
)
7575
s.Require().NoError(err)
7676

@@ -111,9 +111,6 @@ func (s *ConfigApplyUnreferencedFilesTestSuite) TestConfigApply_Test1_TestSubDir
111111
func (s *ConfigApplyUnreferencedFilesTestSuite) TestConfigApply_Test2_TestUpdateUnreferencedInDataPlane() {
112112
slog.Info("starting update unreferenced file in data plane test")
113113

114-
originalContent, readErr := os.ReadFile("configs/unreferenced_file.conf")
115-
s.Require().NoError(readErr)
116-
117114
code, _, updateErr := utils.Container.Exec(s.ctx, []string{
118115
"sh", "-c", "echo '# Updated unreferenced file' >> /etc/nginx/test/unreferenced_file.conf",
119116
})
@@ -124,11 +121,18 @@ func (s *ConfigApplyUnreferencedFilesTestSuite) TestConfigApply_Test2_TestUpdate
124121
utils.PerformConfigApplyWithRequestBody(s.T(), s.nginxInstanceID,
125122
utils.MockManagementPlaneAPIAddress, unrefConfigApplyRequestBody)
126123

127-
code, output, outputErr := utils.Container.Exec(s.ctx, []string{
124+
dataPlaneCode, dataPlaneFileContent, dataPlaneOutputErr := utils.Container.Exec(s.ctx, []string{
128125
"cat", "/etc/nginx/test/unreferenced_file.conf",
129126
})
130-
s.Require().NoError(outputErr)
131-
s.Equal(0, code)
127+
s.Require().NoError(dataPlaneOutputErr)
128+
s.Equal(0, dataPlaneCode)
129+
130+
mockCode, mockFileContent, mockOutputErr := utils.MockManagementPlaneGrpcContainer.Exec(s.ctx, []string{
131+
"cat",
132+
fmt.Sprintf("/mock-management-plane-grpc/config/%s/etc/nginx/test/unreferenced_file.conf", s.nginxInstanceID),
133+
})
134+
s.Require().NoError(mockOutputErr)
135+
s.Equal(0, mockCode)
132136

133137
responses := utils.ManagementPlaneResponses(s.T(), 1, utils.MockManagementPlaneAPIAddress)
134138
s.T().Logf("Config apply responses: %v", responses)
@@ -143,8 +147,8 @@ func (s *ConfigApplyUnreferencedFilesTestSuite) TestConfigApply_Test2_TestUpdate
143147
utils.CheckManifestFile(s.T(), utils.Container, manifestFiles)
144148

145149
s.Equal(mpi.CommandResponse_COMMAND_STATUS_OK, responses[0].GetCommandResponse().GetStatus())
146-
s.Equal("Config apply successful, no files to change", responses[0].GetCommandResponse().GetMessage())
147-
s.NotEqual(originalContent, output)
150+
s.Equal("Config apply successful", responses[0].GetCommandResponse().GetMessage())
151+
s.NotEqual(dataPlaneFileContent, mockFileContent)
148152
slog.Info("finished update unreferenced file in data plane test")
149153
}
150154

0 commit comments

Comments
 (0)