Skip to content

Commit 33599a2

Browse files
xiyayanNagaRajuPasunuri
authored andcommitted
Bug Fix - Incorporated more workrequest status for createSchedule and updateSchedule workflow
1 parent cde8cee commit 33599a2

File tree

7 files changed

+251
-46
lines changed

7 files changed

+251
-46
lines changed

examples/resourcescheduler/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ variable "schedule_state" {
7373
}
7474

7575
variable "schedule_time_ends" {
76-
default = "2024-07-23T17:45:44.408Z"
76+
default = "2024-12-20T00:00:00Z"
7777
}
7878

7979
variable "schedule_time_starts" {
80-
default = "2024-07-13T17:45:44.408Z"
80+
default = "2024-12-01T00:00:00Z"
8181
}
8282

8383

internal/integrationtest/resource_scheduler_schedule_defined_tag_filter_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,10 @@ var (
5151
// Optionals
5252
"description": acctest.Representation{RepType: acctest.Optional, Create: `provider description1`, Update: `provider description2`},
5353
"display_name": acctest.Representation{RepType: acctest.Optional, Create: `provider displayName1`, Update: `provider displayName2`},
54-
"time_ends": acctest.Representation{RepType: acctest.Optional, Create: `2024-06-22T00:00:00Z`, Update: `2024-06-24T00:00:00Z`},
55-
"time_starts": acctest.Representation{RepType: acctest.Optional, Create: `2024-06-16T00:00:00Z`, Update: `2024-06-18T00:00:00Z`},
54+
"time_ends": acctest.Representation{RepType: acctest.Optional, Create: `2024-12-20T00:00:00Z`, Update: `2024-12-30T00:00:00Z`},
55+
"time_starts": acctest.Representation{RepType: acctest.Optional, Create: `2024-12-01T00:00:00Z`, Update: `2024-12-10T00:00:00Z`},
5656
"freeform_tags": acctest.Representation{RepType: acctest.Optional, Create: map[string]string{"Department": "Finance"}, Update: map[string]string{"Department": "Accounting"}},
5757
"defined_tags": acctest.Representation{RepType: acctest.Optional, Create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, Update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
58-
"state": acctest.Representation{RepType: acctest.Optional, Create: `INACTIVE`, Update: `ACTIVE`},
5958
"lifecycle": acctest.RepresentationGroup{RepType: acctest.Optional, Group: ignoreChangesDefinedTagsResourceSchedulerRepresentation},
6059
}
6160
)
@@ -123,8 +122,8 @@ func TestResourceSchedulerScheduleDefinedTagResourceFilter(t *testing.T) {
123122

124123
resource.TestCheckResourceAttr(resourceName, "description", "provider description1"),
125124
resource.TestCheckResourceAttr(resourceName, "display_name", "provider displayName1"),
126-
resource.TestCheckResourceAttr(resourceName, "time_ends", "2024-06-22T00:00:00Z"),
127-
resource.TestCheckResourceAttr(resourceName, "time_starts", "2024-06-16T00:00:00Z"),
125+
resource.TestCheckResourceAttr(resourceName, "time_ends", "2024-12-20T00:00:00Z"),
126+
resource.TestCheckResourceAttr(resourceName, "time_starts", "2024-12-01T00:00:00Z"),
128127
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
129128

130129
resource.TestCheckResourceAttr(resourceName, "resources.#", "0"),

internal/integrationtest/resource_scheduler_schedule_lifecyclestate_test.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ var (
2626
"compartment_id": acctest.Representation{RepType: acctest.Required, Create: `${var.compartment_id}`},
2727
"schedule_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_resource_scheduler_schedule.test_schedule.id}`},
2828
"display_name": acctest.Representation{RepType: acctest.Optional, Create: `provider displayName1`, Update: `provider displayName2`},
29-
"state": acctest.Representation{RepType: acctest.Optional, Create: `AVAILABLE`},
30-
"filter": acctest.RepresentationGroup{RepType: acctest.Optional, Group: ResourceSchedulerScheduleDataSourceFilterRepresentation}}
29+
}
3130

3231
ResourceSchedulerScheduleResourceLifecycleStateFiltersRepresentation = map[string]interface{}{
3332
"attribute": acctest.Representation{RepType: acctest.Required, Create: `LIFECYCLE_STATE`},
@@ -48,11 +47,10 @@ var (
4847
// Optionals
4948
"description": acctest.Representation{RepType: acctest.Optional, Create: `provider description1`, Update: `provider description2`},
5049
"display_name": acctest.Representation{RepType: acctest.Optional, Create: `provider displayName1`, Update: `provider displayName2`},
51-
"time_ends": acctest.Representation{RepType: acctest.Optional, Create: `2024-06-22T00:00:00Z`, Update: `2024-06-24T00:00:00Z`},
52-
"time_starts": acctest.Representation{RepType: acctest.Optional, Create: `2024-06-16T00:00:00Z`, Update: `2024-06-18T00:00:00Z`},
50+
"time_ends": acctest.Representation{RepType: acctest.Optional, Create: `2024-12-20T00:00:00Z`, Update: `2024-12-30T00:00:00Z`},
51+
"time_starts": acctest.Representation{RepType: acctest.Optional, Create: `2024-12-01T00:00:00Z`, Update: `2024-12-10T00:00:00Z`},
5352
"freeform_tags": acctest.Representation{RepType: acctest.Optional, Create: map[string]string{"Department": "Finance"}, Update: map[string]string{"Department": "Accounting"}},
5453
"defined_tags": acctest.Representation{RepType: acctest.Optional, Create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, Update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
55-
"state": acctest.Representation{RepType: acctest.Optional, Create: `INACTIVE`, Update: `ACTIVE`},
5654
"lifecycle": acctest.RepresentationGroup{RepType: acctest.Optional, Group: ignoreChangesDefinedTagsResourceSchedulerRepresentation},
5755
}
5856
)
@@ -118,8 +116,8 @@ func TestResourceSchedulerScheduleLifecycleStateResourceFilter(t *testing.T) {
118116

119117
resource.TestCheckResourceAttr(resourceName, "description", "provider description1"),
120118
resource.TestCheckResourceAttr(resourceName, "display_name", "provider displayName1"),
121-
resource.TestCheckResourceAttr(resourceName, "time_ends", "2024-06-22T00:00:00Z"),
122-
resource.TestCheckResourceAttr(resourceName, "time_starts", "2024-06-16T00:00:00Z"),
119+
resource.TestCheckResourceAttr(resourceName, "time_ends", "2024-12-20T00:00:00Z"),
120+
resource.TestCheckResourceAttr(resourceName, "time_starts", "2024-12-01T00:00:00Z"),
123121
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
124122

125123
resource.TestCheckResourceAttr(resourceName, "resources.#", "0"),

internal/integrationtest/resource_scheduler_schedule_multiple_filters_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
)
1717

1818
var (
19-
multipleConfig = "resource \"oci_resource_scheduler_schedule\" \"test_schedule\" {\n\taction = \"START_RESOURCE\"\n\tcompartment_id = \"${var.compartment_id}\"\n\trecurrence_details = \"FREQ=DAILY;INTERVAL=1\"\n\trecurrence_type = \"ICAL\"\n\tdescription = \"provider description1\"\n\tdisplay_name = \"provider displayName1\"\n\ttime_starts = \"2024-06-16T00:00:00Z\"\n\ttime_ends = \"2024-06-22T00:00:00Z\"\n\tfreeform_tags = {\n\t\t\"Department\"=\"Finance\"\n\t}\n\tresource_filters {\n\t\tattribute = \"DEFINED_TAGS\"\n\t\tvalue {\n\t\t\tnamespace=\"ResourceSchedulerCanary\"\n\t\t\ttag_key=\"ScheduleTagFilterTestKey\"\n\t\t\tvalue=\"foo\"\n\t\t} \n\n\t\tvalue {\n\t\t\tnamespace=\"Test\"\n\t\t\ttag_key=\"ORM-123837\"\n\t\t\tvalue=\"inaccessible\"\n\t\t}\n\t}\n\tresource_filters {\n\t\tattribute = \"RESOURCE_TYPE\"\n\t\tvalue {\n\t\t\tvalue=\"instance\"\n\t\t} \n\t\tvalue {\n\t\t\tvalue=\"autonomousDatabase\"\n\t\t}\n\t}\n\tresource_filters {\n\t\tattribute = \"COMPARTMENT_ID\"\n\t\tvalue {\n\t\t\tvalue=\"ocid1.tenancy.oc1..aaaaaaaacijm644q2oxrhacoweompuuzccbvkqo4syimyapchsl6afxtuqlq\"\n\t\t} \n\t}\n}"
19+
multipleConfig = "resource \"oci_resource_scheduler_schedule\" \"test_schedule\" {\n\taction = \"START_RESOURCE\"\n\tcompartment_id = \"${var.compartment_id}\"\n\trecurrence_details = \"FREQ=DAILY;INTERVAL=1\"\n\trecurrence_type = \"ICAL\"\n\tdescription = \"provider description1\"\n\tdisplay_name = \"provider displayName1\"\n\ttime_starts = \"2024-12-01T00:00:00Z\"\n\ttime_ends = \"2024-12-20T00:00:00Z\"\n\tfreeform_tags = {\n\t\t\"Department\"=\"Finance\"\n\t}\n\tresource_filters {\n\t\tattribute = \"DEFINED_TAGS\"\n\t\tvalue {\n\t\t\tnamespace=\"ResourceSchedulerCanary\"\n\t\t\ttag_key=\"ScheduleTagFilterTestKey\"\n\t\t\tvalue=\"foo\"\n\t\t} \n\n\t\tvalue {\n\t\t\tnamespace=\"Test\"\n\t\t\ttag_key=\"ORM-123837\"\n\t\t\tvalue=\"inaccessible\"\n\t\t}\n\t}\n\tresource_filters {\n\t\tattribute = \"RESOURCE_TYPE\"\n\t\tvalue {\n\t\t\tvalue=\"instance\"\n\t\t} \n\t\tvalue {\n\t\t\tvalue=\"autonomousDatabase\"\n\t\t}\n\t}\n\tresource_filters {\n\t\tattribute = \"COMPARTMENT_ID\"\n\t\tvalue {\n\t\t\tvalue=\"ocid1.tenancy.oc1..aaaaaaaacijm644q2oxrhacoweompuuzccbvkqo4syimyapchsl6afxtuqlq\"\n\t\t} \n\t}\n}"
2020
)
2121

2222
func TestResourceSchedulerScheduleMultipleFiltersResourceFilter(t *testing.T) {
@@ -44,8 +44,8 @@ func TestResourceSchedulerScheduleMultipleFiltersResourceFilter(t *testing.T) {
4444
resource.TestCheckResourceAttr(resourceName, "recurrence_type", "ICAL"),
4545
resource.TestCheckResourceAttr(resourceName, "description", "provider description1"),
4646
resource.TestCheckResourceAttr(resourceName, "display_name", "provider displayName1"),
47-
resource.TestCheckResourceAttr(resourceName, "time_ends", "2024-06-22T00:00:00Z"),
48-
resource.TestCheckResourceAttr(resourceName, "time_starts", "2024-06-16T00:00:00Z"),
47+
resource.TestCheckResourceAttr(resourceName, "time_ends", "2024-12-20T00:00:00Z"),
48+
resource.TestCheckResourceAttr(resourceName, "time_starts", "2024-12-01T00:00:00Z"),
4949
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
5050

5151
resource.TestCheckResourceAttr(resourceName, "resources.#", "0"),
@@ -61,12 +61,12 @@ func TestResourceSchedulerScheduleMultipleFiltersResourceFilter(t *testing.T) {
6161
resource.TestCheckResourceAttr(resourceName, "resource_filters.0.value.1.value", "inaccessible"),
6262

6363
resource.TestCheckResourceAttr(resourceName, "resource_filters.1.attribute", "RESOURCE_TYPE"),
64-
resource.TestCheckResourceAttr(resourceName, "resource_filters.0.value.#", "2"),
65-
resource.TestCheckResourceAttr(resourceName, "resource_filters.0.value.0.value", "instance"),
66-
resource.TestCheckResourceAttr(resourceName, "resource_filters.0.value.1.value", "autonomousDatabase"),
64+
resource.TestCheckResourceAttr(resourceName, "resource_filters.1.value.#", "2"),
65+
resource.TestCheckResourceAttr(resourceName, "resource_filters.1.value.0.value", "instance"),
66+
resource.TestCheckResourceAttr(resourceName, "resource_filters.1.value.1.value", "autonomousDatabase"),
6767

68-
resource.TestCheckResourceAttr(resourceName, "resource_filters.1.attribute", "COMPARTMENT_ID"),
69-
resource.TestCheckResourceAttr(resourceName, "resource_filters.0.value.#", "1"),
68+
resource.TestCheckResourceAttr(resourceName, "resource_filters.2.attribute", "COMPARTMENT_ID"),
69+
resource.TestCheckResourceAttr(resourceName, "resource_filters.2.value.#", "1"),
7070

7171
func(s *terraform.State) (err error) {
7272
_, err = acctest.FromInstanceState(s, resourceName, "id")

0 commit comments

Comments
 (0)