diff --git a/tests/integration/jupyter_experiment_test.go b/tests/integration/jupyter_experiment_test.go index 4fd06f5..3fa7c02 100644 --- a/tests/integration/jupyter_experiment_test.go +++ b/tests/integration/jupyter_experiment_test.go @@ -1,11 +1,11 @@ package tests import ( - "slices" "context" "log/slog" "os" "path/filepath" + "slices" "testing" "time" diff --git a/tests/integration/reproducibility/run_manifest_test.go b/tests/integration/reproducibility/run_manifest_test.go index 1ebf2c8..fc1af79 100644 --- a/tests/integration/reproducibility/run_manifest_test.go +++ b/tests/integration/reproducibility/run_manifest_test.go @@ -64,7 +64,7 @@ func TestRunManifestReproducibility(t *testing.T) { MaxWorkers: 4, SandboxNetworkMode: "none", SandboxNoNewPrivs: true, - ComplianceMode: "standard", + ComplianceMode: "standard", } m2 := manifest.NewRunManifest("run-2", "task-2", "job-2", created) @@ -74,7 +74,7 @@ func TestRunManifestReproducibility(t *testing.T) { MaxWorkers: 4, SandboxNetworkMode: "none", SandboxNoNewPrivs: true, - ComplianceMode: "standard", + ComplianceMode: "standard", } // Write manifests diff --git a/tests/integration/security/secrets_integration_test.go b/tests/integration/security/secrets_integration_test.go index 9d780af..03fbb90 100644 --- a/tests/integration/security/secrets_integration_test.go +++ b/tests/integration/security/secrets_integration_test.go @@ -147,28 +147,28 @@ func TestSecretsRotation(t *testing.T) { // TestSecretsPatternDetection validates specific secret pattern detection func TestSecretsPatternDetection(t *testing.T) { patterns := []struct { - value string + value string shouldMatch bool - pattern string + pattern string }{ // AWS patterns {"AKIAIOSFODNN7EXAMPLE", true, "AWS Access Key"}, {"ASIAIOSFODNN7EXAMPLE", true, "AWS Session Key"}, {"AKIA1234567890", true, "AWS Access Key short"}, - - // GitHub patterns + + // GitHub patterns {"ghp_xxxxxxxxxxxxxxxxxxxx", true, "GitHub Personal Token"}, {"gho_xxxxxxxxxxxxxxxxxxxx", true, "GitHub OAuth"}, {"github_pat_xxxxxxxxxx", true, "GitHub App Token"}, - + // GitLab patterns {"glpat-xxxxxxxxxxxxxxxx", true, "GitLab Token"}, - + // OpenAI/Stripe patterns {"sk-xxxxxxxxxxxxxxxxxxxxxxxx", true, "OpenAI/Stripe Secret"}, {"sk_test_xxxxxxxxxxxxxx", true, "Stripe Test Key"}, {"sk_live_xxxxxxxxxxxxxx", true, "Stripe Live Key"}, - + // Non-secrets that should NOT match {"not-a-secret", false, "Plain text"}, {"password123", false, "Simple password"}, @@ -181,7 +181,7 @@ func TestSecretsPatternDetection(t *testing.T) { t.Run(p.pattern, func(t *testing.T) { // Check if the value looks like a secret looksLikeSecret := looksLikeSecretHelper(p.value) - + if p.shouldMatch && !looksLikeSecret { t.Errorf("Expected '%s' to be detected as secret but wasn't", p.value) } @@ -200,13 +200,13 @@ func looksLikeSecretHelper(value string) bool { // Check for known secret patterns patterns := []string{ - "AKIA", // AWS Access Key - "ASIA", // AWS Session Key - "ghp_", // GitHub personal - "gho_", // GitHub OAuth + "AKIA", // AWS Access Key + "ASIA", // AWS Session Key + "ghp_", // GitHub personal + "gho_", // GitHub OAuth "github_pat_", // GitHub app - "glpat-", // GitLab - "sk-", // OpenAI/Stripe + "glpat-", // GitLab + "sk-", // OpenAI/Stripe } for _, pattern := range patterns { diff --git a/tests/integration/storage_redis_integration_test.go b/tests/integration/storage_redis_integration_test.go index 38c3612..f5ec13f 100644 --- a/tests/integration/storage_redis_integration_test.go +++ b/tests/integration/storage_redis_integration_test.go @@ -219,7 +219,7 @@ func TestStorageRedisMetricsIntegration(t *testing.T) { // Record system metrics in Redis ctx := context.Background() systemMetricsKey := "ml:metrics:system" - metricsData := map[string]interface{}{ + metricsData := map[string]any{ "timestamp": time.Now().Unix(), "cpu_total": 85.2, "memory_total": 4096.0, diff --git a/tests/load/load_test.go b/tests/load/load_test.go index c49afcd..d9d2510 100644 --- a/tests/load/load_test.go +++ b/tests/load/load_test.go @@ -557,9 +557,9 @@ func (ltr *LoadTestRunner) generatePayload(workerID int) []byte { return nil } - payload := map[string]interface{}{ + payload := map[string]any{ "job_name": fmt.Sprintf("load-test-job-%d-%d", workerID, time.Now().UnixNano()), - "args": map[string]interface{}{ + "args": map[string]any{ "model": "test-model", "data": generateRandomData(ltr.Config.PayloadSize), "worker_id": workerID, diff --git a/tests/unit/api/helpers/response_helpers_test.go b/tests/unit/api/helpers/response_helpers_test.go index 9c580ca..d5df23d 100644 --- a/tests/unit/api/helpers/response_helpers_test.go +++ b/tests/unit/api/helpers/response_helpers_test.go @@ -260,7 +260,7 @@ func TestParseResourceRequest(t *testing.T) { func TestMarshalJSONOrEmpty(t *testing.T) { tests := []struct { name string - data interface{} + data any want []byte }{ { diff --git a/tests/unit/reproducibility/config_hash_test.go b/tests/unit/reproducibility/config_hash_test.go index af2909e..5fd2c3f 100644 --- a/tests/unit/reproducibility/config_hash_test.go +++ b/tests/unit/reproducibility/config_hash_test.go @@ -102,8 +102,8 @@ func TestConfigHashPostDefaults(t *testing.T) { MaxWorkers: 4, GPUVendor: "nvidia", Sandbox: worker.SandboxConfig{ - NetworkMode: "none", - SeccompProfile: "default-hardened", + NetworkMode: "none", + SeccompProfile: "default-hardened", NoNewPrivileges: true, }, ComplianceMode: "standard", @@ -115,8 +115,8 @@ func TestConfigHashPostDefaults(t *testing.T) { MaxWorkers: 4, GPUVendor: "nvidia", Sandbox: worker.SandboxConfig{ - NetworkMode: "none", - SeccompProfile: "default-hardened", + NetworkMode: "none", + SeccompProfile: "default-hardened", NoNewPrivileges: true, }, ComplianceMode: "standard", diff --git a/tests/unit/security/filetype_test.go b/tests/unit/security/filetype_test.go index 6af931d..6fc7b2c 100644 --- a/tests/unit/security/filetype_test.go +++ b/tests/unit/security/filetype_test.go @@ -12,69 +12,69 @@ func TestValidateFileType_AllowedTypes(t *testing.T) { tempDir := t.TempDir() tests := []struct { - name string - content []byte - ext string - wantType string - wantErr bool + name string + content []byte + ext string + wantType string + wantErr bool }{ { name: "valid safetensors (ZIP magic)", content: []byte{0x50, 0x4B, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00}, - ext: ".safetensors", + ext: ".safetensors", wantType: "safetensors", wantErr: false, }, { name: "valid GGUF", content: []byte{0x47, 0x47, 0x55, 0x46, 0x00, 0x00, 0x00, 0x00}, - ext: ".gguf", + ext: ".gguf", wantType: "gguf", wantErr: false, }, { name: "valid JSON", content: []byte(`{"key": "value"}`), - ext: ".json", + ext: ".json", wantType: "json", wantErr: false, }, { name: "valid text file", content: []byte("Hello, World!"), - ext: ".txt", + ext: ".txt", wantType: "text", wantErr: false, }, { - name: "dangerous pickle extension", - content: []byte{0x00, 0x00, 0x00, 0x00}, + name: "dangerous pickle extension", + content: []byte{0x00, 0x00, 0x00, 0x00}, ext: ".pkl", - wantErr: true, + wantErr: true, }, { - name: "dangerous pytorch extension", - content: []byte{0x00, 0x00, 0x00, 0x00}, + name: "dangerous pytorch extension", + content: []byte{0x00, 0x00, 0x00, 0x00}, ext: ".pt", - wantErr: true, + wantErr: true, }, { - name: "executable extension", - content: []byte{0x00, 0x00, 0x00, 0x00}, + name: "executable extension", + content: []byte{0x00, 0x00, 0x00, 0x00}, ext: ".exe", - wantErr: true, + wantErr: true, }, { - name: "script extension", - content: []byte("#!/bin/bash"), + name: "script extension", + content: []byte("#!/bin/bash"), ext: ".sh", - wantErr: true, + wantErr: true, }, { - name: "archive extension", - content: []byte{0x00, 0x00, 0x00, 0x00}, + name: "archive extension", + content: []byte{0x00, 0x00, 0x00, 0x00}, ext: ".zip", - wantErr: true, + wantErr: true, }, } @@ -107,10 +107,10 @@ func TestValidateModelFile(t *testing.T) { tempDir := t.TempDir() tests := []struct { - name string - content []byte - ext string - wantErr bool + name string + content []byte + ext string + wantErr bool }{ { name: "valid model - safetensors",