|
9 | 9 | ) |
10 | 10 |
|
11 | 11 | var ( |
| 12 | + testClusterLoggingConfCustomTarget *managementClient.ClusterLogging |
| 13 | + testClusterLoggingInterfaceCustomTarget map[string]interface{} |
12 | 14 | testClusterLoggingConfElasticSearch *managementClient.ClusterLogging |
13 | 15 | testClusterLoggingInterfaceElasticSearch map[string]interface{} |
14 | 16 | testClusterLoggingConfFluentd *managementClient.ClusterLogging |
|
22 | 24 | ) |
23 | 25 |
|
24 | 26 | func init() { |
| 27 | + testLoggingCustomTargetConf = &managementClient.CustomTargetConfig{ |
| 28 | + Certificate: "certificate", |
| 29 | + ClientCert: "client_cert", |
| 30 | + ClientKey: "client_key", |
| 31 | + Content: "content", |
| 32 | + } |
| 33 | + testLoggingCustomTargetInterface = []interface{}{ |
| 34 | + map[string]interface{}{ |
| 35 | + "certificate": "certificate", |
| 36 | + "client_cert": "client_cert", |
| 37 | + "client_key": "client_key", |
| 38 | + "content": "content", |
| 39 | + }, |
| 40 | + } |
25 | 41 | testLoggingElasticsearchConf = &managementClient.ElasticsearchConfig{ |
26 | 42 | Endpoint: "hostname.test", |
27 | 43 | DateFormat: "YYYY-MM-DD", |
@@ -152,6 +168,29 @@ func init() { |
152 | 168 | "token": "XXXXXXXXXXXX", |
153 | 169 | }, |
154 | 170 | } |
| 171 | + testClusterLoggingConfCustomTarget = &managementClient.ClusterLogging{ |
| 172 | + ClusterID: "cluster-test", |
| 173 | + Name: "test", |
| 174 | + CustomTargetConfig: testLoggingCustomTargetConf, |
| 175 | + NamespaceId: "namespace-test", |
| 176 | + OutputFlushInterval: 10, |
| 177 | + OutputTags: map[string]string{ |
| 178 | + "outputTag1": "value1", |
| 179 | + "outputTag2": "value2", |
| 180 | + }, |
| 181 | + } |
| 182 | + testClusterLoggingInterfaceCustomTarget = map[string]interface{}{ |
| 183 | + "cluster_id": "cluster-test", |
| 184 | + "name": "test", |
| 185 | + "kind": loggingCustomTargetKind, |
| 186 | + "custom_target_config": testLoggingCustomTargetInterface, |
| 187 | + "namespace_id": "namespace-test", |
| 188 | + "output_flush_interval": 10, |
| 189 | + "output_tags": map[string]interface{}{ |
| 190 | + "outputTag1": "value1", |
| 191 | + "outputTag2": "value2", |
| 192 | + }, |
| 193 | + } |
155 | 194 | testClusterLoggingConfElasticSearch = &managementClient.ClusterLogging{ |
156 | 195 | ClusterID: "cluster-test", |
157 | 196 | Name: "test", |
@@ -275,6 +314,10 @@ func TestFlattenClusterLogging(t *testing.T) { |
275 | 314 | Input *managementClient.ClusterLogging |
276 | 315 | ExpectedOutput map[string]interface{} |
277 | 316 | }{ |
| 317 | + { |
| 318 | + testClusterLoggingConfCustomTarget, |
| 319 | + testClusterLoggingInterfaceCustomTarget, |
| 320 | + }, |
278 | 321 | { |
279 | 322 | testClusterLoggingConfElasticSearch, |
280 | 323 | testClusterLoggingInterfaceElasticSearch, |
@@ -320,6 +363,10 @@ func TestExpandClusterLogging(t *testing.T) { |
320 | 363 | Input map[string]interface{} |
321 | 364 | ExpectedOutput *managementClient.ClusterLogging |
322 | 365 | }{ |
| 366 | + { |
| 367 | + testClusterLoggingInterfaceCustomTarget, |
| 368 | + testClusterLoggingConfCustomTarget, |
| 369 | + }, |
323 | 370 | { |
324 | 371 | testClusterLoggingInterfaceElasticSearch, |
325 | 372 | testClusterLoggingConfElasticSearch, |
|
0 commit comments