Skip to content

Commit 2420262

Browse files
authored
Merge pull request ovh#366 from ovh/ldp_improvements_230124
fix(dbaas-logs): input tests
2 parents cd7ab27 + 14b3e99 commit 2420262

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

ovh/data_dbaas_logs_input_engine_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ data "ovh_dbaas_logs_input_engine" "logstash" {
2828
func TestAccDataSourceDbaasLogsInputEngine_basic(t *testing.T) {
2929
serviceName := os.Getenv("OVH_DBAAS_LOGS_SERVICE_TEST")
3030
name := "LOGSTASH"
31-
version := "7.x"
31+
// version := "7.x"
32+
version := os.Getenv("OVH_DBAAS_LOGS_LOGSTASH_VERSION_TEST")
3233

3334
config := fmt.Sprintf(
3435
testAccDataSourceDbaasLogsInputEngine_basic,
@@ -38,7 +39,7 @@ func TestAccDataSourceDbaasLogsInputEngine_basic(t *testing.T) {
3839
)
3940

4041
resource.Test(t, resource.TestCase{
41-
PreCheck: func() { testAccPreCheckDbaasLogs(t) },
42+
PreCheck: func() { testAccPreCheckDbaasLogsInput(t) },
4243

4344
Providers: testAccProviders,
4445
Steps: []resource.TestStep{
@@ -53,7 +54,7 @@ func TestAccDataSourceDbaasLogsInputEngine_basic(t *testing.T) {
5354
resource.TestCheckResourceAttr(
5455
"data.ovh_dbaas_logs_input_engine.logstash",
5556
"version",
56-
"7.x",
57+
version,
5758
),
5859
),
5960
},

ovh/provider_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ func testAccPreCheckDbaasLogs(t *testing.T) {
168168
checkEnvOrSkip(t, "OVH_DBAAS_LOGS_SERVICE_TEST")
169169
}
170170

171+
func testAccPreCheckDbaasLogsInput(t *testing.T) {
172+
testAccPreCheckCredentials(t)
173+
checkEnvOrSkip(t, "OVH_DBAAS_LOGS_SERVICE_TEST")
174+
checkEnvOrSkip(t, "OVH_DBAAS_LOGS_LOGSTASH_VERSION_TEST")
175+
}
176+
171177
// Checks that the environment variables needed for the /cloud acceptance tests
172178
// are set.
173179
func testAccPreCheckCloud(t *testing.T) {

ovh/resource_dbaas_logs_input_test.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ import (
1414
)
1515

1616
const testAccResourceDbaasLogsInput_basic = `
17-
data "ovh_dbaas_logs_input_engine" "logstash" {
18-
name = "logstash"
19-
version = "7.x"
17+
data "ovh_dbaas_logs_input_engine" "logstash" {
18+
service_name = "%s"
19+
name = "%s"
20+
version = "%s"
2021
}
2122
2223
resource "ovh_dbaas_logs_output_graylog_stream" "stream" {
@@ -152,18 +153,23 @@ func testSweepDbaasInput(region string) error {
152153

153154
func TestAccResourceDbaasLogsInput_basic(t *testing.T) {
154155
serviceName := os.Getenv("OVH_DBAAS_LOGS_SERVICE_TEST")
156+
name := "LOGSTASH"
157+
version := os.Getenv("OVH_DBAAS_LOGS_LOGSTASH_VERSION_TEST")
155158
title := acctest.RandomWithPrefix(test_prefix)
156159
desc := acctest.RandomWithPrefix(test_prefix)
157160

158161
config := fmt.Sprintf(
159162
testAccResourceDbaasLogsInput_basic,
160163
serviceName,
164+
name,
165+
version,
166+
serviceName,
161167
title,
162168
desc,
163169
)
164170

165171
resource.Test(t, resource.TestCase{
166-
PreCheck: func() { testAccPreCheckDbaasLogs(t) },
172+
PreCheck: func() { testAccPreCheckDbaasLogsInput(t) },
167173

168174
Providers: testAccProviders,
169175
Steps: []resource.TestStep{

website/docs/index.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ variables must also be set:
163163

164164
* `OVH_DBAAS_LOGS_SERVICE_TEST` - The name of your Dbaas logs service.
165165

166+
* `OVH_DBAAS_LOGS_LOGSTASH_VERSION_TEST` - The name of your Dbaas logs Logstash version.
167+
166168
* `OVH_TESTACC_ORDER_VRACK` - set this variable to "yes" will order vracks.
167169

168170
* `OVH_TESTACC_ORDER_CLOUDPROJECT` - set this variable to "yes" will order cloud projects.

0 commit comments

Comments
 (0)