@@ -8,19 +8,15 @@ import (
8
8
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
9
9
)
10
10
11
- const testAccDataSourceDbaasLogsCluster = `
12
- data "ovh_dbaas_logs_cluster" "ldp" {
13
- service_name = "%s"
14
- cluster_id = "%s"
15
- }
16
- `
17
-
18
11
func TestAccDataSourceDbaasLogsCluster (t * testing.T ) {
19
12
serviceName := os .Getenv ("OVH_DBAAS_LOGS_SERVICE_TEST" )
20
13
clusterId := os .Getenv ("OVH_DBAAS_LOGS_CLUSTER_ID" )
21
14
22
- config := fmt .Sprintf (
23
- testAccDataSourceDbaasLogsCluster ,
15
+ config := fmt .Sprintf (`
16
+ data "ovh_dbaas_logs_cluster" "ldp" {
17
+ service_name = "%s"
18
+ cluster_id = "%s"
19
+ }` ,
24
20
serviceName ,
25
21
clusterId ,
26
22
)
@@ -38,6 +34,46 @@ func TestAccDataSourceDbaasLogsCluster(t *testing.T) {
38
34
"service_name" ,
39
35
serviceName ,
40
36
),
37
+ resource .TestCheckResourceAttr (
38
+ "data.ovh_dbaas_logs_cluster.ldp" ,
39
+ "cluster_id" ,
40
+ clusterId ,
41
+ ),
42
+ ),
43
+ },
44
+ },
45
+ })
46
+ }
47
+
48
+ func TestAccDataSourceDbaasLogsClusterDefault (t * testing.T ) {
49
+ serviceName := os .Getenv ("OVH_DBAAS_LOGS_SERVICE_TEST" )
50
+ clusterId := os .Getenv ("OVH_DBAAS_LOGS_CLUSTER_ID" )
51
+
52
+ config := fmt .Sprintf (`
53
+ data "ovh_dbaas_logs_cluster" "ldp" {
54
+ service_name = "%s"
55
+ }` ,
56
+ serviceName ,
57
+ )
58
+
59
+ resource .Test (t , resource.TestCase {
60
+ PreCheck : func () { testAccPreCheckDbaasLogsCluster (t ) },
61
+
62
+ Providers : testAccProviders ,
63
+ Steps : []resource.TestStep {
64
+ {
65
+ Config : config ,
66
+ Check : resource .ComposeTestCheckFunc (
67
+ resource .TestCheckResourceAttr (
68
+ "data.ovh_dbaas_logs_cluster.ldp" ,
69
+ "service_name" ,
70
+ serviceName ,
71
+ ),
72
+ resource .TestCheckResourceAttr (
73
+ "data.ovh_dbaas_logs_cluster.ldp" ,
74
+ "cluster_id" ,
75
+ clusterId ,
76
+ ),
41
77
),
42
78
},
43
79
},
0 commit comments