(t *testing.T)
| 70 | } |
| 71 | |
| 72 | func TestCloudSQLDialOptions(t *testing.T) { |
| 73 | tests := []struct { |
| 74 | name string |
| 75 | ipType storepb.DataSource_CloudSQLIPType |
| 76 | wantLen int |
| 77 | }{ |
| 78 | {"unspecified defaults to public", storepb.DataSource_CLOUD_SQL_IP_TYPE_UNSPECIFIED, 0}, |
| 79 | {"public", storepb.DataSource_PUBLIC, 0}, |
| 80 | {"private", storepb.DataSource_PRIVATE, 1}, |
| 81 | {"psc", storepb.DataSource_PSC, 1}, |
| 82 | } |
| 83 | for _, tc := range tests { |
| 84 | t.Run(tc.name, func(t *testing.T) { |
| 85 | if got := cloudSQLDialOptions(&storepb.DataSource{CloudSqlIpType: tc.ipType}); len(got) != tc.wantLen { |
| 86 | t.Errorf("cloudSQLDialOptions(%v) = %d options, want %d", tc.ipType, len(got), tc.wantLen) |
| 87 | } |
| 88 | }) |
| 89 | } |
| 90 | } |
nothing calls this directly
no test coverage detected