fix: Add test for wrapping init script with single quotes (#2979)

This ensures our initialization script works with single  uotes.
This commit is contained in:
Kyle Carberry
2022-07-13 17:43:48 -05:00
committed by GitHub
parent b5f5e909bd
commit 8e17254785
3 changed files with 8 additions and 5 deletions
+4 -1
View File
@@ -46,7 +46,10 @@ func TestAgentScript(t *testing.T) {
}
script = strings.ReplaceAll(script, "${ACCESS_URL}", srvURL.String()+"/")
script = strings.ReplaceAll(script, "${AUTH_TYPE}", "token")
output, err := exec.Command("sh", "-c", script).CombinedOutput()
// This is intentionally ran in single quotes to mimic how a customer may
// embed our script. Our scripts should not include any single quotes.
// nolint:gosec
output, err := exec.Command("sh", "-c", "sh -c '"+script+"'").CombinedOutput()
t.Log(string(output))
require.NoError(t, err)
// Ignore debug output from `set -x`, we're only interested in the last line.