Skip to content

Commit 222a518

Browse files
committed
feat(cockpit): fix test
1 parent 4a0148b commit 222a518

File tree

2 files changed

+546
-42
lines changed

2 files changed

+546
-42
lines changed

internal/services/cockpit/source_data_source_test.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cockpit_test
22

33
import (
4+
"fmt"
45
"testing"
56

67
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
@@ -84,23 +85,36 @@ func TestAccCockpitSource_DataSource_ByName(t *testing.T) {
8485
func TestAccCockpitSource_DataSource_Defaults(t *testing.T) {
8586
tt := acctest.NewTestTools(t)
8687
defer tt.Cleanup()
87-
88+
orgID, orgIDExists := tt.Meta.ScwClient().GetDefaultOrganizationID()
89+
if !orgIDExists {
90+
orgID = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
91+
}
8892
resource.ParallelTest(t, resource.TestCase{
8993
PreCheck: func() { acctest.PreCheck(t) },
9094
ProviderFactories: tt.ProviderFactories,
95+
9196
Steps: []resource.TestStep{
9297
{
93-
Config: `
98+
Config: fmt.Sprintf(`
99+
100+
data scaleway_account_project "by_name" {
101+
name = "default"
102+
organization_id = "%s"
103+
}
104+
105+
94106
data "scaleway_cockpit_source" "default_metrics" {
107+
project_id = data.scaleway_account_project.by_name.id
95108
type = "metrics"
96109
origin = "scaleway"
97110
}
98111
99112
data "scaleway_cockpit_source" "default_logs" {
113+
project_id = data.scaleway_account_project.by_name.id
100114
type = "logs"
101115
origin = "scaleway"
102116
}
103-
`,
117+
`, orgID),
104118
Check: resource.ComposeTestCheckFunc(
105119
resource.TestCheckResourceAttr("data.scaleway_cockpit_source.default_metrics", "name", "Scaleway Metrics"),
106120
resource.TestCheckResourceAttr("data.scaleway_cockpit_source.default_metrics", "type", "metrics"),

0 commit comments

Comments
 (0)