Skip to content
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
6 changes: 3 additions & 3 deletions castai/data_source_resource_rebalancing_schedule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ func TestRebalancingScheduleDataSourceRead(t *testing.T) {
"aggressiveMode": false,
"aggressiveModeConfig": {
"ignoreLocalPersistentVolumes": true,
"ignoreProblemJobPods": true,
"ignoreProblemRemovalDisabledPods": true,
"ignoreProblemPodsWithoutController": true
"ignoreProblemJobPods": true,
"ignoreProblemRemovalDisabledPods": true,
"ignoreProblemPodsWithoutController": true
}
},
"numTargetedNodes": 20,
Expand Down
8 changes: 4 additions & 4 deletions castai/resource_node_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -1057,9 +1057,9 @@ func toAKSEphemeralOSDisk(obj any) *sdk.NodeconfigV1AKSConfigOsDiskEphemeral {
if v, ok := obj.(map[string]any)["placement"].(string); ok && v != "" {
switch v {
case aksEphemeralDiskPlacementResourceDisk:
osDisk.Placement = lo.ToPtr(sdk.PLACEMENTRESOURCEDISK)
osDisk.Placement = lo.ToPtr(sdk.NodeconfigV1AKSConfigOsDiskEphemeralPlacementPLACEMENTRESOURCEDISK)
case aksEphemeralDiskPlacementCacheDisk:
osDisk.Placement = lo.ToPtr(sdk.PLACEMENTCACHEDISK)
osDisk.Placement = lo.ToPtr(sdk.NodeconfigV1AKSConfigOsDiskEphemeralPlacementPLACEMENTCACHEDISK)
}
}

Expand Down Expand Up @@ -1206,9 +1206,9 @@ func fromAKSEphemeralOSDisk(sdkEph *sdk.NodeconfigV1AKSConfigOsDiskEphemeral) []
m := map[string]interface{}{}
if sdkEph.Placement != nil {
switch *sdkEph.Placement {
case sdk.PLACEMENTRESOURCEDISK:
case sdk.NodeconfigV1AKSConfigOsDiskEphemeralPlacementPLACEMENTRESOURCEDISK:
m["placement"] = aksEphemeralDiskPlacementResourceDisk
case sdk.PLACEMENTCACHEDISK:
case sdk.NodeconfigV1AKSConfigOsDiskEphemeralPlacementPLACEMENTCACHEDISK:
m["placement"] = aksEphemeralDiskPlacementCacheDisk
}
}
Expand Down
31 changes: 18 additions & 13 deletions castai/resource_rebalancing_schedule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,6 @@ func TestAccResourceRebalancingSchedule_basic(t *testing.T) {
resource.TestCheckResourceAttr("castai_rebalancing_schedule.test", "schedule.0.cron", "5 4 * * *"),
),
},
{
// import by ID
ImportState: true,
ResourceName: "castai_rebalancing_schedule.test",
ImportStateVerify: true,
},
{
// import by name
ImportState: true,
ResourceName: "castai_rebalancing_schedule.test",
ImportStateId: rName,
ImportStateVerify: true,
},
{
// test edits
Config: makeUpdatedRebalancingScheduleConfig(rName + " renamed"),
Expand All @@ -56,6 +43,24 @@ func TestAccResourceRebalancingSchedule_basic(t *testing.T) {
resource.TestCheckResourceAttr("castai_rebalancing_schedule.test", "launch_configuration.0.rebalancing_min_nodes", "0"),
),
},
// We keep the ImportState test cases at the end so they will test any newly added fields.
// This way it will also verify that after importing the state the output of `tf plan` is empty.
{
// Import state by ID
ImportState: true,
ResourceName: "castai_rebalancing_schedule.test",
ImportStateVerify: true,
},
{
// Import state by name
ImportState: true,
ResourceName: "castai_rebalancing_schedule.test",
// Make sure to use the resource (rebalancing schedule) name from the latest prior step that changes the resource,
// otherwise this step will not to see the changes made after the State ID you provided,
// and this step will fail.
ImportStateId: rName + " min_nodes_zero",
ImportStateVerify: true,
},
},
})
}
Expand Down
Loading
Loading