#secret not found error in integration test
1 messages · Page 1 of 1 (latest)
// Generate 512000 random bytes (non UTF-8)
// This is our current limit: secrets break at 512001 bytes
data := make([]byte, 512000)
_, err := rand.Read(data)
if err != nil {
panic(err)
}
// Compute the MD5 hash of the data
hash := md5.Sum(data)
hashStr := hex.EncodeToString(hash[:])
dir := t.TempDir()
require.NoError(t, os.WriteFile(filepath.Join(dir, "some-file"), data, 0o600))
secret := dag.Host().SetSecretFile("mysecret", filepath.Join(dir, "some-file"))
output, err := c.Container().
From("alpine:latest").
WithEnvVariable("CACHEBUST", identity.NewID()).
WithMountedSecret(
"/mysecret",
secret,
).
WithExec([]string{"md5sum", "/mysecret"}).
Stdout(ctx)
require.NoError(t, err)
// Extract the MD5 hash from the command output
hashStrCmd := strings.Split(output, " ")[0]
require.Equal(t, hashStr, hashStrCmd)
})
oh maybe I know. i should use c.Host() instead of dag.Host()