High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
test: remove env-var-gated config tests
Datab1e4f8ceb611
diff --git a/tests/integration/config_test.go b/tests/integration/config_test.goindex 74e06a10..2b337217 100644--- a/tests/integration/config_test.go+++ b/tests/integration/config_test.go@@ -3,7 +3,6 @@package integrationimport (- "os""regexp""strings""testing"@@ -110,105 +109,6 @@ func TestConfig_ChromeVersionInFingerprint(t *testing.T) {t.Logf("Initial version: %s, Rotated version: %s", initialVersion, rotatedVersion)}-// CF6: Chrome version override-// Set BRIDGE_CHROME_VERSION via TEST_CHROME_VERSION environment variable.-// Usage: TEST_CHROME_VERSION=999.0.0.0 go test -tags integration -v -run TestConfig_ChromeVersionOverride-func TestConfig_ChromeVersionOverride(t *testing.T) {- // Check if TEST_CHROME_VERSION was set (which would have been passed to Pinchtab via BRIDGE_CHROME_VERSION)- testVersion := os.Getenv("TEST_CHROME_VERSION")- if testVersion == "" {- t.Skip("TEST_CHROME_VERSION not set; set it to run this test (e.g., TEST_CHROME_VERSION=999.0.0.0 go test -tags integration -v)")- }-- navigate(t, "https://example.com")-- code, body := httpPost(t, "/evaluate", map[string]string{- "tabId": currentTabID,- "expression": "navigator.userAgent",- })- if code != 200 {- t.Fatalf("expected 200, got %d", code)- }-- ua := jsonField(t, body, "result")- ua = strings.Trim(ua, `"`)-- // Extract Chrome version from UA- version := extractChromeVersion(ua)- if version == "" {- t.Errorf("expected user agent to contain Chrome version, got: %s", ua)- }-- // Verify the Chrome version matches what was set via TEST_CHROME_VERSION- if version != testVersion {- t.Errorf("expected Chrome version %q, but got %q in UA: %s", testVersion, version, ua)- }-- t.Logf("Chrome version override working: %s", version)-}--// CF4: Custom profile directory-// Verify that BRIDGE_PROFILE environment variable is accepted and server starts.-// Usage: TEST_PROFILE_DIR=/tmp/custom-profile go test -tags integration -v -run TestConfig_CustomProfileDir-func TestConfig_CustomProfileDir(t *testing.T) {- // Check if TEST_PROFILE_DIR was set- testProfileDir := os.Getenv("TEST_PROFILE_DIR")- if testProfileDir == "" {- t.Skip("TEST_PROFILE_DIR not set; set it to run this test (e.g., TEST_PROFILE_DIR=/tmp/custom-profile go test -tags integration -v)")- }-- // If we reach here, the server has already been started with the custom profile dir.- // Simply verify the server is responding to requests - this confirms BRIDGE_PROFILE- // was accepted and the server started without error.- navigate(t, "https://example.com")-- code, body := httpPost(t, "/evaluate", map[string]string{- "tabId": currentTabID,- "expression": "window.location.href",- })- if code != 200 {- t.Fatalf("expected 200, got %d (body: %s)", code, body)- }-- result := jsonField(t, body, "result")- if result == "" {- t.Errorf("expected non-empty result from evaluate")- }-- t.Logf("Custom profile directory test passed: server responding normally")-}--// CF5: NO_RESTORE configuration-// Verify that BRIDGE_NO_RESTORE environment variable is accepted and server starts.-// Usage: TEST_NO_RESTORE=true go test -tags integration -v -run TestConfig_NoRestore-func TestConfig_NoRestore(t *testing.T) {- // Check if TEST_NO_RESTORE was set- testNoRestore := os.Getenv("TEST_NO_RESTORE")- if testNoRestore == "" {- t.Skip("TEST_NO_RESTORE not set; set it to run this test (e.g., TEST_NO_RESTORE=true go test -tags integration -v)")- }-- // If we reach here, the server has already been started with the NO_RESTORE config.- // Simply verify the server is responding to requests - this confirms BRIDGE_NO_RESTORE- // was accepted and the server started without error.- navigate(t, "https://example.com")-- code, body := httpPost(t, "/evaluate", map[string]string{- "tabId": currentTabID,- "expression": "window.location.href",- })- if code != 200 {- t.Fatalf("expected 200, got %d (body: %s)", code, body)- }-- result := jsonField(t, body, "result")- if result == "" {- t.Errorf("expected non-empty result from evaluate")- }-- t.Logf("NO_RESTORE configuration test passed: server responding normally")-}-// CF1: Config file preference (functional test)// Verify that Pinchtab loads successfully and starts when a config file exists.// This test confirms the server is running after config file was loaded.@@ -256,34 +156,3 @@ func TestConfig_EnvOverridesConfig(t *testing.T) {t.Logf("Env override test passed: server using env var configuration")}--// CF3: CDP URL external Chrome (simpler functional test)-// Verify that CDP_URL environment variable is accepted and server starts without crash.-// This is a functional test that server can start with CDP_URL set, regardless of connection success.-func TestConfig_CDPURLExternalChrome(t *testing.T) {- // Check if TEST_CDP_URL was set- testCDPURL := os.Getenv("TEST_CDP_URL")- if testCDPURL == "" {- t.Skip("TEST_CDP_URL not set; set it to run this test (e.g., TEST_CDP_URL=ws://localhost:9222 go test -tags integration -v)")- }-- // If we reach here, the server has already started with CDP_URL set.- // Simply verify the server is responding - this confirms CDP_URL was accepted- // and the server started without crash/error from CDP config parsing.- navigate(t, "https://example.com")-- code, body := httpPost(t, "/evaluate", map[string]string{- "tabId": currentTabID,- "expression": "navigator.userAgent",- })- if code != 200 {- t.Logf("evaluate returned %d (may indicate Chrome connection issue, but config accepted)", code)- } else {- result := jsonField(t, body, "result")- if result != "" {- t.Logf("CDP_URL test passed: server started with external CDP URL")- }- }-- t.Logf("CDP URL configuration test completed: server started without crash")-}diff --git a/tests/integration/main_test.go b/tests/integration/main_test.goindex ca279628..16e0c964 100644--- a/tests/integration/main_test.go+++ b/tests/integration/main_test.go@@ -19,17 +19,6 @@ var (currentTabID string // Track current tab for action operations)-// removeEnvPrefix removes all environment variables starting with the given prefix-func removeEnvPrefix(env []string, prefix string) []string {- result := []string{}- for _, e := range env {- if !strings.HasPrefix(e, prefix) {- result = append(result, e)- }- }- return result-}-func TestMain(m *testing.M) {port := os.Getenv("PINCHTAB_TEST_PORT")if port == "" {@@ -76,27 +65,6 @@ func TestMain(m *testing.M) {env = append(env, "CHROME_BINARY="+chromeBinary)}- // Pass BRIDGE_CHROME_VERSION if TEST_CHROME_VERSION is set- if testChromeVersion := os.Getenv("TEST_CHROME_VERSION"); testChromeVersion != "" {- fmt.Fprintf(os.Stderr, "TestMain: setting BRIDGE_CHROME_VERSION=%s from TEST_CHROME_VERSION\n", testChromeVersion)- env = append(env, "BRIDGE_CHROME_VERSION="+testChromeVersion)- }-- // Pass BRIDGE_PROFILE if TEST_PROFILE_DIR is set- if testProfileDir := os.Getenv("TEST_PROFILE_DIR"); testProfileDir != "" {- fmt.Fprintf(os.Stderr, "TestMain: setting BRIDGE_PROFILE=%s from TEST_PROFILE_DIR\n", testProfileDir)- // Remove the default BRIDGE_PROFILE and use the test-specified one- env = removeEnvPrefix(env, "BRIDGE_PROFILE=")- env = append(env, "BRIDGE_PROFILE="+testProfileDir)- }-- // Handle BRIDGE_NO_RESTORE - only disable if TEST_NO_RESTORE is explicitly set- if testNoRestore := os.Getenv("TEST_NO_RESTORE"); testNoRestore != "" {- fmt.Fprintf(os.Stderr, "TestMain: setting BRIDGE_NO_RESTORE=%s from TEST_NO_RESTORE\n", testNoRestore)- env = removeEnvPrefix(env, "BRIDGE_NO_RESTORE=")- env = append(env, "BRIDGE_NO_RESTORE="+testNoRestore)- }-cmd.Env = envcmd.Stdout = os.Stdoutcmd.Stderr = os.Stderr