Tests validate S3 Outposts endpoint detector.
(t *testing.T)
| 181 | |
| 182 | // Tests validate S3 Outposts endpoint detector. |
| 183 | func TestIsAmazonOutpostsEndpoint(t *testing.T) { |
| 184 | testCases := []struct { |
| 185 | url string |
| 186 | result bool |
| 187 | }{ |
| 188 | {"https://s3.amazonaws.com", false}, |
| 189 | {"https://s3.eu-west-1.amazonaws.com", false}, |
| 190 | {"https://storage.googleapis.com", false}, |
| 191 | {"https://test-access-point-000000000000.op-00000000000000000.s3-outposts.eu-central-1.amazonaws.com", true}, |
| 192 | {"https://myap-123456789012.op-0ab1c2d3e4f5.s3-outposts.us-west-2.amazonaws.com", true}, |
| 193 | {"https://accesspoint-account.op-outpostid.s3-outposts.eu-north-1.amazonaws.com", true}, |
| 194 | } |
| 195 | for i, testCase := range testCases { |
| 196 | u, err := url.Parse(testCase.url) |
| 197 | if err != nil { |
| 198 | t.Errorf("Test %d: url.Parse failed: %v", i+1, err) |
| 199 | continue |
| 200 | } |
| 201 | got := IsAmazonOutpostsEndpoint(*u) |
| 202 | if got != testCase.result { |
| 203 | t.Errorf("Test %d: IsAmazonOutpostsEndpoint(%q) = %v, want %v", i+1, testCase.url, got, testCase.result) |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | // Tests validate Amazon endpoint validator. |
| 209 | func TestIsAmazonEndpoint(t *testing.T) { |
nothing calls this directly
no test coverage detected