Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dbaas-logs): input tests #366

Merged
merged 3 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions ovh/data_dbaas_logs_input_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ data "ovh_dbaas_logs_input_engine" "logstash" {
func TestAccDataSourceDbaasLogsInputEngine_basic(t *testing.T) {
serviceName := os.Getenv("OVH_DBAAS_LOGS_SERVICE_TEST")
name := "LOGSTASH"
version := "7.x"
// version := "7.x"
version := os.Getenv("OVH_DBAAS_LOGS_LOGSTASH_VERSION_TEST")

config := fmt.Sprintf(
testAccDataSourceDbaasLogsInputEngine_basic,
Expand All @@ -38,7 +39,7 @@ func TestAccDataSourceDbaasLogsInputEngine_basic(t *testing.T) {
)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheckDbaasLogs(t) },
PreCheck: func() { testAccPreCheckDbaasLogsInput(t) },

Providers: testAccProviders,
Steps: []resource.TestStep{
Expand All @@ -53,7 +54,7 @@ func TestAccDataSourceDbaasLogsInputEngine_basic(t *testing.T) {
resource.TestCheckResourceAttr(
"data.ovh_dbaas_logs_input_engine.logstash",
"version",
"7.x",
version,
),
),
},
Expand Down
6 changes: 6 additions & 0 deletions ovh/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ func testAccPreCheckDbaasLogs(t *testing.T) {
checkEnvOrSkip(t, "OVH_DBAAS_LOGS_SERVICE_TEST")
}

func testAccPreCheckDbaasLogsInput(t *testing.T) {
testAccPreCheckCredentials(t)
checkEnvOrSkip(t, "OVH_DBAAS_LOGS_SERVICE_TEST")
checkEnvOrSkip(t, "OVH_DBAAS_LOGS_LOGSTASH_VERSION_TEST")
}

// Checks that the environment variables needed for the /cloud acceptance tests
// are set.
func testAccPreCheckCloud(t *testing.T) {
Expand Down
14 changes: 10 additions & 4 deletions ovh/resource_dbaas_logs_input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import (
)

const testAccResourceDbaasLogsInput_basic = `
data "ovh_dbaas_logs_input_engine" "logstash" {
name = "logstash"
version = "7.x"
data "ovh_dbaas_logs_input_engine" "logstash" {
service_name = "%s"
name = "%s"
version = "%s"
}

resource "ovh_dbaas_logs_output_graylog_stream" "stream" {
Expand Down Expand Up @@ -152,18 +153,23 @@ func testSweepDbaasInput(region string) error {

func TestAccResourceDbaasLogsInput_basic(t *testing.T) {
serviceName := os.Getenv("OVH_DBAAS_LOGS_SERVICE_TEST")
name := "LOGSTASH"
version := os.Getenv("OVH_DBAAS_LOGS_LOGSTASH_VERSION_TEST")
title := acctest.RandomWithPrefix(test_prefix)
desc := acctest.RandomWithPrefix(test_prefix)

config := fmt.Sprintf(
testAccResourceDbaasLogsInput_basic,
serviceName,
name,
version,
serviceName,
title,
desc,
)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheckDbaasLogs(t) },
PreCheck: func() { testAccPreCheckDbaasLogsInput(t) },

Providers: testAccProviders,
Steps: []resource.TestStep{
Expand Down
2 changes: 2 additions & 0 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ variables must also be set:

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

* `OVH_DBAAS_LOGS_LOGSTASH_VERSION_TEST` - The name of your Dbaas logs Logstash version.

* `OVH_TESTACC_ORDER_VRACK` - set this variable to "yes" will order vracks.

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