(t *testing.T)
| 96 | } |
| 97 | |
| 98 | func TestUserAgentWithVersionEnvVar(t *testing.T) { |
| 99 | os.Setenv("CSQL_PROXY_USER_AGENT", "cloud-sql-proxy-operator/0.0.1") |
| 100 | defer os.Unsetenv("CSQL_PROXY_USER_AGENT") |
| 101 | |
| 102 | cmd, err := invokeProxyCommand([]string{"proj:region:inst"}) |
| 103 | if err != nil { |
| 104 | t.Fatalf("want error = nil, got = %v", err) |
| 105 | } |
| 106 | |
| 107 | want := "cloud-sql-proxy-operator/0.0.1" |
| 108 | got := cmd.conf.UserAgent |
| 109 | if !strings.Contains(got, want) { |
| 110 | t.Errorf("expected user agent to contain: %v; got: %v", want, got) |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | func TestUserAgent(t *testing.T) { |
| 115 | cmd, err := invokeProxyCommand( |
nothing calls this directly
no test coverage detected