(t *testing.T)
| 894 | } |
| 895 | |
| 896 | func TestAutoIAMAuthNQueryParams(t *testing.T) { |
| 897 | tcs := []struct { |
| 898 | desc string |
| 899 | args []string |
| 900 | want *bool |
| 901 | }{ |
| 902 | { |
| 903 | desc: "when the query string is absent", |
| 904 | args: []string{"proj:region:inst"}, |
| 905 | want: nil, |
| 906 | }, |
| 907 | { |
| 908 | desc: "when the query string is true", |
| 909 | args: []string{"proj:region:inst?auto-iam-authn=true"}, |
| 910 | want: pointer(true), |
| 911 | }, |
| 912 | { |
| 913 | desc: "when the query string is (short) t", |
| 914 | args: []string{"proj:region:inst?auto-iam-authn=t"}, |
| 915 | want: pointer(true), |
| 916 | }, |
| 917 | { |
| 918 | desc: "when the query string is false", |
| 919 | args: []string{"proj:region:inst?auto-iam-authn=false"}, |
| 920 | want: pointer(false), |
| 921 | }, |
| 922 | { |
| 923 | desc: "when the query string is (short) f", |
| 924 | args: []string{"proj:region:inst?auto-iam-authn=f"}, |
| 925 | want: pointer(false), |
| 926 | }, |
| 927 | } |
| 928 | for _, tc := range tcs { |
| 929 | t.Run(tc.desc, func(t *testing.T) { |
| 930 | c, err := invokeProxyCommand(tc.args) |
| 931 | if err != nil { |
| 932 | t.Fatalf("command.Execute: %v", err) |
| 933 | } |
| 934 | if tc.want == nil && c.conf.Instances[0].IAMAuthN == nil { |
| 935 | return |
| 936 | } |
| 937 | if got := c.conf.Instances[0].IAMAuthN; *got != *tc.want { |
| 938 | t.Errorf("args = %v, want = %v, got = %v", tc.args, *tc.want, *got) |
| 939 | } |
| 940 | }) |
| 941 | } |
| 942 | } |
| 943 | |
| 944 | func TestPrivateIPQueryParams(t *testing.T) { |
| 945 | tcs := []struct { |
nothing calls this directly
no test coverage detected