Skip to content

Commit 0c1fdf3

Browse files
authored
[Internal] fix TestUcAccDataSourceShares flakiness (#4526)
## Changes When multiple integration tests are running in parallel, the count of `databricks_shares_pluginframework` data sources will change. This means tfplan is not clean and the test fails ``` Changes to Outputs: ~ shares = 6 -> 4 ``` We should inspect tf state instead of the output. ## Tests - [x] covered with integration tests in `internal/acceptance` NO_CHANGELOG=true
1 parent cb54060 commit 0c1fdf3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

internal/providers/pluginfw/products/sharing/data_shares_acc_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212

1313
func checkSharesDataSourcePopulated(t *testing.T) func(s *terraform.State) error {
1414
return func(s *terraform.State) error {
15-
_, ok := s.Modules[0].Resources["data.databricks_shares_pluginframework.this"]
15+
ds, ok := s.Modules[0].Resources["data.databricks_shares_pluginframework.this"]
1616
require.True(t, ok, "data.databricks_shares_pluginframework.this has to be there")
17-
num_shares, _ := strconv.Atoi(s.Modules[0].Outputs["shares"].Value.(string))
17+
num_shares, _ := strconv.Atoi(ds.Primary.Attributes["shares.#"])
1818
assert.GreaterOrEqual(t, num_shares, 1)
1919
return nil
2020
}
@@ -89,9 +89,6 @@ func TestUcAccDataSourceShares(t *testing.T) {
8989
data "databricks_shares_pluginframework" "this" {
9090
depends_on = [databricks_share_pluginframework.myshare]
9191
}
92-
output "shares" {
93-
value = length(data.databricks_shares_pluginframework.this.shares)
94-
}
9592
`,
9693
Check: checkSharesDataSourcePopulated(t),
9794
})

0 commit comments

Comments
 (0)