@@ -42,7 +42,7 @@ func TestNewCommandArguments(t *testing.T) {
42
42
c .Instances = []proxy.InstanceConnConfig {{}}
43
43
}
44
44
if i := & c .Instances [0 ]; i .Name == "" {
45
- i .Name = "proj: region: inst"
45
+ i .Name = "/projects/ proj/locations/ region/clusters/clust/instances/ inst"
46
46
}
47
47
return c
48
48
}
@@ -53,56 +53,56 @@ func TestNewCommandArguments(t *testing.T) {
53
53
}{
54
54
{
55
55
desc : "basic invocation with defaults" ,
56
- args : []string {"proj: region: inst" },
56
+ args : []string {"/projects/ proj/locations/ region/clusters/clust/instances/ inst" },
57
57
want : withDefaults (& proxy.Config {
58
58
Addr : "127.0.0.1" ,
59
- Instances : []proxy.InstanceConnConfig {{Name : "proj: region: inst" }},
59
+ Instances : []proxy.InstanceConnConfig {{Name : "/projects/ proj/locations/ region/clusters/clust/instances/ inst" }},
60
60
}),
61
61
},
62
62
{
63
63
desc : "using the address flag" ,
64
- args : []string {"--address" , "0.0.0.0" , "proj: region: inst" },
64
+ args : []string {"--address" , "0.0.0.0" , "/projects/ proj/locations/ region/clusters/clust/instances/ inst" },
65
65
want : withDefaults (& proxy.Config {
66
66
Addr : "0.0.0.0" ,
67
- Instances : []proxy.InstanceConnConfig {{Name : "proj: region: inst" }},
67
+ Instances : []proxy.InstanceConnConfig {{Name : "/projects/ proj/locations/ region/clusters/clust/instances/ inst" }},
68
68
}),
69
69
},
70
70
{
71
71
desc : "using the address (short) flag" ,
72
- args : []string {"-a" , "0.0.0.0" , "proj: region: inst" },
72
+ args : []string {"-a" , "0.0.0.0" , "/projects/ proj/locations/ region/clusters/clust/instances/ inst" },
73
73
want : withDefaults (& proxy.Config {
74
74
Addr : "0.0.0.0" ,
75
- Instances : []proxy.InstanceConnConfig {{Name : "proj: region: inst" }},
75
+ Instances : []proxy.InstanceConnConfig {{Name : "/projects/ proj/locations/ region/clusters/clust/instances/ inst" }},
76
76
}),
77
77
},
78
78
{
79
79
desc : "using the address query param" ,
80
- args : []string {"proj: region: inst?address=0.0.0.0" },
80
+ args : []string {"/projects/ proj/locations/ region/clusters/clust/instances/ inst?address=0.0.0.0" },
81
81
want : withDefaults (& proxy.Config {
82
82
Addr : "127.0.0.1" ,
83
83
Instances : []proxy.InstanceConnConfig {{
84
84
Addr : "0.0.0.0" ,
85
- Name : "proj: region: inst" ,
85
+ Name : "/projects/ proj/locations/ region/clusters/clust/instances/ inst" ,
86
86
}},
87
87
}),
88
88
},
89
89
{
90
90
desc : "using the port flag" ,
91
- args : []string {"--port" , "6000" , "proj: region: inst" },
91
+ args : []string {"--port" , "6000" , "/projects/ proj/locations/ region/clusters/clust/instances/ inst" },
92
92
want : withDefaults (& proxy.Config {
93
93
Port : 6000 ,
94
94
}),
95
95
},
96
96
{
97
97
desc : "using the port (short) flag" ,
98
- args : []string {"-p" , "6000" , "proj: region: inst" },
98
+ args : []string {"-p" , "6000" , "/projects/ proj/locations/ region/clusters/clust/instances/ inst" },
99
99
want : withDefaults (& proxy.Config {
100
100
Port : 6000 ,
101
101
}),
102
102
},
103
103
{
104
104
desc : "using the port query param" ,
105
- args : []string {"proj: region: inst?port=6000" },
105
+ args : []string {"/projects/ proj/locations/ region/clusters/clust/instances/ inst?port=6000" },
106
106
want : withDefaults (& proxy.Config {
107
107
Instances : []proxy.InstanceConnConfig {{
108
108
Port : 6000 ,
@@ -111,28 +111,28 @@ func TestNewCommandArguments(t *testing.T) {
111
111
},
112
112
{
113
113
desc : "using the token flag" ,
114
- args : []string {"--token" , "MYCOOLTOKEN" , "proj: region: inst" },
114
+ args : []string {"--token" , "MYCOOLTOKEN" , "/projects/ proj/locations/ region/clusters/clust/instances/ inst" },
115
115
want : withDefaults (& proxy.Config {
116
116
Token : "MYCOOLTOKEN" ,
117
117
}),
118
118
},
119
119
{
120
120
desc : "using the token (short) flag" ,
121
- args : []string {"-t" , "MYCOOLTOKEN" , "proj: region: inst" },
121
+ args : []string {"-t" , "MYCOOLTOKEN" , "/projects/ proj/locations/ region/clusters/clust/instances/ inst" },
122
122
want : withDefaults (& proxy.Config {
123
123
Token : "MYCOOLTOKEN" ,
124
124
}),
125
125
},
126
126
{
127
127
desc : "using the credentiale file flag" ,
128
- args : []string {"--credentials-file" , "/path/to/file" , "proj: region: inst" },
128
+ args : []string {"--credentials-file" , "/path/to/file" , "/projects/ proj/locations/ region/clusters/clust/instances/ inst" },
129
129
want : withDefaults (& proxy.Config {
130
130
CredentialsFile : "/path/to/file" ,
131
131
}),
132
132
},
133
133
{
134
134
desc : "using the (short) credentiale file flag" ,
135
- args : []string {"-c" , "/path/to/file" , "proj: region: inst" },
135
+ args : []string {"-c" , "/path/to/file" , "/projects/ proj/locations/ region/clusters/clust/instances/ inst" },
136
136
want : withDefaults (& proxy.Config {
137
137
CredentialsFile : "/path/to/file" ,
138
138
}),
@@ -174,41 +174,41 @@ func TestNewCommandWithErrors(t *testing.T) {
174
174
},
175
175
{
176
176
desc : "when the query string is bogus" ,
177
- args : []string {"proj: region: inst?%=foo" },
177
+ args : []string {"/projects/ proj/locations/ region/clusters/clust/instances/ inst?%=foo" },
178
178
},
179
179
{
180
180
desc : "when the address query param is empty" ,
181
- args : []string {"proj: region: inst?address=" },
181
+ args : []string {"/projects/ proj/locations/ region/clusters/clust/instances/ inst?address=" },
182
182
},
183
183
{
184
184
desc : "using the address flag with a bad IP address" ,
185
- args : []string {"--address" , "bogus" , "proj: region: inst" },
185
+ args : []string {"--address" , "bogus" , "/projects/ proj/locations/ region/clusters/clust/instances/ inst" },
186
186
},
187
187
{
188
188
desc : "when the address query param is not an IP address" ,
189
- args : []string {"proj: region: inst?address=世界" },
189
+ args : []string {"/projects/ proj/locations/ region/clusters/clust/instances/ inst?address=世界" },
190
190
},
191
191
{
192
192
desc : "when the address query param contains multiple values" ,
193
- args : []string {"proj: region: inst?address=0.0.0.0&address=1.1.1.1&address=2.2.2.2" },
193
+ args : []string {"/projects/ proj/locations/ region/clusters/clust/instances/ inst?address=0.0.0.0&address=1.1.1.1&address=2.2.2.2" },
194
194
},
195
195
{
196
196
desc : "when the query string is invalid" ,
197
- args : []string {"proj: region: inst?address=1.1.1.1?foo=2.2.2.2" },
197
+ args : []string {"/projects/ proj/locations/ region/clusters/clust/instances/ inst?address=1.1.1.1?foo=2.2.2.2" },
198
198
},
199
199
{
200
200
desc : "when the port query param contains multiple values" ,
201
- args : []string {"proj: region: inst?port=1&port=2" },
201
+ args : []string {"/projects/ proj/locations/ region/clusters/clust/instances/ inst?port=1&port=2" },
202
202
},
203
203
{
204
204
desc : "when the port query param is not a number" ,
205
- args : []string {"proj: region: inst?port=hi" },
205
+ args : []string {"/projects/ proj/locations/ region/clusters/clust/instances/ inst?port=hi" },
206
206
},
207
207
{
208
208
desc : "when both token and credentials file is set" ,
209
209
args : []string {
210
210
"--token" , "my-token" ,
211
- "--credentials-file" , "/path/to/file" , "proj: region: inst" },
211
+ "--credentials-file" , "/path/to/file" , "/projects/ proj/locations/ region/clusters/clust/instances/ inst" },
212
212
},
213
213
}
214
214
@@ -256,7 +256,7 @@ func (*spyDialer) Close() error {
256
256
}
257
257
258
258
func TestCommandWithCustomDialer (t * testing.T ) {
259
- want := "my-project: my-region: my-cluster: my-instance"
259
+ want := "/projects/ my-project/locations/ my-region/clusters/ my-cluster/instances/ my-instance"
260
260
s := & spyDialer {}
261
261
c := NewCommand (WithDialer (s ))
262
262
// Keep the test output quiet
0 commit comments