Skip to content

Commit f550d8d

Browse files
committed
fix(test): set MySQL credentials file permissions in combined config tests
The MySQL receiver validates that passfiles have 0600 or 0400 permissions for security. Git doesn't preserve file permissions beyond the executable bit, so checked-out files default to 0644 in CI, causing test failures. Add os.Chmod(0600) calls in TestCombinedV1V2EC2Config and TestCombinedV1V2EKSConfig before config translation to ensure the .mysql_credentials testdata file has the required restrictive permissions. This matches the existing fix in TestDBIMySQLConfigLinux and ensures tests pass reliably in CI and local development environments.
1 parent 0ea2209 commit f550d8d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

translator/tocwconfig/tocwconfig_unix_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,17 @@ func TestJournaldLogsUnitsAndPriority(t *testing.T) {
144144
func TestCombinedV1V2EC2Config(t *testing.T) {
145145
resetContext(t)
146146
context.CurrentContext().SetMode(config.ModeEC2)
147+
// Fix MySQL credentials file permissions (required by receiver validation)
148+
require.NoError(t, os.Chmod("sampleConfig/opentelemetry/testdata/.mysql_credentials", 0600))
147149
checkTranslation(t, "opentelemetry/combined_v1_v2_ec2_config", "linux", nil, "")
148150
}
149151

150152
func TestCombinedV1V2EKSConfig(t *testing.T) {
151153
resetContext(t)
152154
context.CurrentContext().SetMode(config.ModeEC2)
153155
context.CurrentContext().SetKubernetesMode(config.ModeEKS)
156+
// Fix MySQL credentials file permissions (required by receiver validation)
157+
require.NoError(t, os.Chmod("sampleConfig/opentelemetry/testdata/.mysql_credentials", 0600))
154158

155159
// Cannot use checkTranslation here because the container_insights prometheus
156160
// receiver references /var/run/secrets/kubernetes.io/serviceaccount/token

0 commit comments

Comments
 (0)