Skip to content

Commit 7632af7

Browse files
committed
test: move ImportState scheduled rebalancing test cases to the end
1 parent c542936 commit 7632af7

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

castai/resource_rebalancing_schedule_test.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,6 @@ func TestAccResourceRebalancingSchedule_basic(t *testing.T) {
2323
resource.TestCheckResourceAttr("castai_rebalancing_schedule.test", "schedule.0.cron", "5 4 * * *"),
2424
),
2525
},
26-
{
27-
// import by ID
28-
ImportState: true,
29-
ResourceName: "castai_rebalancing_schedule.test",
30-
ImportStateVerify: true,
31-
},
32-
{
33-
// import by name
34-
ImportState: true,
35-
ResourceName: "castai_rebalancing_schedule.test",
36-
ImportStateId: rName,
37-
ImportStateVerify: true,
38-
},
3926
{
4027
// test edits
4128
Config: makeUpdatedRebalancingScheduleConfig(rName + " renamed"),
@@ -56,6 +43,21 @@ func TestAccResourceRebalancingSchedule_basic(t *testing.T) {
5643
resource.TestCheckResourceAttr("castai_rebalancing_schedule.test", "launch_configuration.0.rebalancing_min_nodes", "0"),
5744
),
5845
},
46+
// We keep the ImportState test cases at the end so they will test any newly added fields.
47+
// This way it will also verify that after importing the state the output of `tf plan` is empty.
48+
{
49+
// import by ID
50+
ImportState: true,
51+
ResourceName: "castai_rebalancing_schedule.test",
52+
ImportStateVerify: true,
53+
},
54+
{
55+
// import by name
56+
ImportState: true,
57+
ResourceName: "castai_rebalancing_schedule.test",
58+
ImportStateId: rName,
59+
ImportStateVerify: true,
60+
},
5961
},
6062
})
6163
}

0 commit comments

Comments
 (0)