MCPcopy Index your code
hub / github.com/GoogleCloudPlatform/cloud-sql-proxy / TestUserAgentWithVersionEnvVar

Function TestUserAgentWithVersionEnvVar

cmd/root_test.go:98–112  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

96}
97
98func 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
114func TestUserAgent(t *testing.T) {
115 cmd, err := invokeProxyCommand(

Callers

nothing calls this directly

Calls 2

invokeProxyCommandFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected