Refactor Nomad Command Generation.

- Abstracting from the exec form while generating.
- Removal of single quotes (usage of only double-quotes).
- Bash-nesting using escaping of special characters.
This commit is contained in:
Maximilian Paß
2023-03-06 00:20:09 +00:00
committed by Sebastian Serth
parent f309d0f70e
commit 7dadc5dfe9
13 changed files with 1148 additions and 150 deletions

View File

@@ -128,7 +128,7 @@ func (s *E2ETestSuite) TestListFileSystem_Nomad() {
listFilesResponse := new(dto.ListFileSystemResponse)
err = json.NewDecoder(response.Body).Decode(listFilesResponse)
s.Require().NoError(err)
s.Require().Equal(len(listFilesResponse.Files), 1)
s.Require().Equal(1, len(listFilesResponse.Files))
fileHeader := listFilesResponse.Files[0]
s.Equal(dto.FilePath("./"+tests.DefaultFileName), fileHeader.Name)
s.Equal(dto.EntryTypeRegularFile, fileHeader.EntryType)
@@ -322,8 +322,9 @@ func (s *E2ETestSuite) TestCopyFilesRoute_ProtectedFolders() {
// User manipulates protected folder
s.Run("User can create files", func() {
log.WithField("id", runnerID).Debug("Runner ID")
webSocketURL, err := ProvideWebSocketURL(runnerID, &dto.ExecutionRequest{
Command: fmt.Sprintf("touch %s/userfile", protectedFolderPath),
Command: fmt.Sprintf("touch %s%s", protectedFolderPath, "userfile"),
TimeLimit: int(tests.DefaultTestTimeout.Seconds()),
PrivilegedExecution: false,
})