(t *testing.T)
| 66 | } |
| 67 | |
| 68 | func TestGetContainerClient(t *testing.T) { |
| 69 | cfg := Config{ |
| 70 | StorageAccountName: "devstoreaccount1", |
| 71 | StorageAccountKey: flagext.SecretWithValue("dGVzdAo="), |
| 72 | ContainerName: "traces", |
| 73 | } |
| 74 | |
| 75 | tests := []struct { |
| 76 | name string |
| 77 | endpoint string |
| 78 | expectedURL string |
| 79 | }{ |
| 80 | { |
| 81 | name: "localhost", |
| 82 | endpoint: "localhost:10000", |
| 83 | expectedURL: "http://localhost:10000/devstoreaccount1/traces", |
| 84 | }, |
| 85 | { |
| 86 | name: "Azure China", |
| 87 | endpoint: "blob.core.chinacloudapi.cn", |
| 88 | expectedURL: "https://devstoreaccount1.blob.core.chinacloudapi.cn/traces", |
| 89 | }, |
| 90 | { |
| 91 | name: "Azure US Government", |
| 92 | endpoint: "blob.core.usgovcloudapi.net", |
| 93 | expectedURL: "https://devstoreaccount1.blob.core.usgovcloudapi.net/traces", |
| 94 | }, |
| 95 | { |
| 96 | name: "Azure German", |
| 97 | endpoint: "blob.core.cloudapi.de", |
| 98 | expectedURL: "https://devstoreaccount1.blob.core.cloudapi.de/traces", |
| 99 | }, |
| 100 | } |
| 101 | |
| 102 | for _, tc := range tests { |
| 103 | t.Run(tc.name, func(t *testing.T) { |
| 104 | cfg.Endpoint = tc.endpoint |
| 105 | |
| 106 | client, err := getContainerClient(context.Background(), &cfg, false) |
| 107 | assert.NoError(t, err) |
| 108 | assert.Equal(t, tc.expectedURL, client.URL()) |
| 109 | }) |
| 110 | } |
| 111 | } |
nothing calls this directly
no test coverage detected