Skip to content

Commit 5c11b27

Browse files
authored
direct: Set default reason="custom" for OverrideChangeDesc (#4383)
## Changes When OverrideChangeDesc function changes the action but not the reason, set the reason to "custom". ## Why It's easy to accidentally forget to update the reason in OverrideChangeDesc func (this is what happens for dashboards today). ## Tests Existing tests that record the plan.
1 parent 7626c8f commit 5c11b27

15 files changed

Lines changed: 45 additions & 11 deletions

File tree

acceptance/bundle/migrate/dashboards/out.plan_after_migrate.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323
"changes": {
2424
"etag": {
2525
"action": "skip",
26+
"reason": "custom",
2627
"old": "[NUMID]",
2728
"remote": "[NUMID]"
2829
},
2930
"serialized_dashboard": {
3031
"action": "skip",
32+
"reason": "custom",
3133
"old": "{\"pages\":[{\"name\":\"02724bf2\",\"displayName\":\"Dashboard test bundle-deploy-dashboard\"}]}\n",
3234
"new": "{\"pages\":[{\"name\":\"02724bf2\",\"displayName\":\"Dashboard test bundle-deploy-dashboard\"}]}\n",
3335
"remote": "{\"pages\":[{\"displayName\":\"Dashboard test bundle-deploy-dashboard\",\"name\":\"02724bf2\",\"pageType\":\"PAGE_TYPE_CANVAS\"}]}\n"

acceptance/bundle/migrate/runas/out.plan.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"changes": {
3838
"run_as": {
3939
"action": "skip",
40-
"reason": "override",
40+
"reason": "custom",
4141
"old": {
4242
"service_principal_name": "[UUID]"
4343
},

acceptance/bundle/resources/clusters/deploy/update-and-resize-autoscale/out.plan_.direct.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,14 @@
144144
"changes": {
145145
"autoscale.max_workers": {
146146
"action": "resize",
147+
"reason": "custom",
147148
"old": 5,
148149
"new": 6,
149150
"remote": 5
150151
},
151152
"autoscale.min_workers": {
152153
"action": "resize",
154+
"reason": "custom",
153155
"old": 3,
154156
"new": 4,
155157
"remote": 3
@@ -190,6 +192,7 @@
190192
"changes": {
191193
"autoscale": {
192194
"action": "resize",
195+
"reason": "custom",
193196
"old": {
194197
"max_workers": 6,
195198
"min_workers": 4
@@ -201,6 +204,7 @@
201204
},
202205
"num_workers": {
203206
"action": "resize",
207+
"reason": "custom",
204208
"new": 3
205209
}
206210
}

acceptance/bundle/resources/clusters/deploy/update-and-resize/out.plan_.direct.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
"changes": {
9797
"num_workers": {
9898
"action": "resize",
99+
"reason": "custom",
99100
"old": 3,
100101
"new": 4,
101102
"remote": 3
@@ -139,6 +140,7 @@
139140
"changes": {
140141
"num_workers": {
141142
"action": "resize",
143+
"reason": "custom",
142144
"old": 4,
143145
"new": 5,
144146
"remote": 4

acceptance/bundle/resources/dashboards/dataset-catalog-schema/out.plan.direct.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,19 @@
2323
"changes": {
2424
"dataset_catalog": {
2525
"action": "skip",
26+
"reason": "custom",
2627
"old": "main",
2728
"new": "main"
2829
},
2930
"dataset_schema": {
3031
"action": "skip",
32+
"reason": "custom",
3133
"old": "default",
3234
"new": "default"
3335
},
3436
"etag": {
3537
"action": "skip",
38+
"reason": "custom",
3639
"old": [ETAG],
3740
"remote": [ETAG]
3841
},

acceptance/bundle/resources/dashboards/delete-trashed-out-of-band/out.plan.direct.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"changes": {
2020
"etag": {
2121
"action": "update",
22-
"reason": "remote_already_set",
22+
"reason": "custom",
2323
"old": [ETAG]
2424
}
2525
}

acceptance/bundle/resources/dashboards/detect-change/out.plan.direct.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
},
3939
"serialized_dashboard": {
4040
"action": "skip",
41+
"reason": "custom",
4142
"old": "{\n \"pages\": [\n {\n \"displayName\": \"New Page\",\n \"layout\": [\n {\n \"position\": {\n \"height\": 2,\n \"width\": 6,\n \"x\": 0,\n \"y\": 0\n },\n \"widget\": {\n \"name\": \"82eb9107\",\n \"textbox_spec\": \"# I'm a title\"\n }\n },\n {\n \"position\": {\n \"height\": 2,\n \"width\": 6,\n \"x\": 0,\n \"y\": 2\n },\n \"widget\": {\n \"name\": \"ffa6de4f\",\n \"textbox_spec\": \"Text\"\n }\n }\n ],\n \"name\": \"fdd21a3c\"\n }\n ]\n}\n",
4243
"new": "{\n \"pages\": [\n {\n \"displayName\": \"New Page\",\n \"layout\": [\n {\n \"position\": {\n \"height\": 2,\n \"width\": 6,\n \"x\": 0,\n \"y\": 0\n },\n \"widget\": {\n \"name\": \"82eb9107\",\n \"textbox_spec\": \"# I'm a title\"\n }\n },\n {\n \"position\": {\n \"height\": 2,\n \"width\": 6,\n \"x\": 0,\n \"y\": 2\n },\n \"widget\": {\n \"name\": \"ffa6de4f\",\n \"textbox_spec\": \"Text\"\n }\n }\n ],\n \"name\": \"fdd21a3c\"\n }\n ]\n}\n",
4344
"remote": "{}\n"

acceptance/bundle/resources/dashboards/simple/out.plan.direct.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323
"changes": {
2424
"etag": {
2525
"action": "skip",
26+
"reason": "custom",
2627
"old": [ETAG],
2728
"remote": [ETAG]
2829
},
2930
"serialized_dashboard": {
3031
"action": "skip",
32+
"reason": "custom",
3133
"old": "{ }\n",
3234
"new": "{ }\n",
3335
"remote": "{}\n"

acceptance/bundle/resources/dashboards/unpublish-out-of-band/out.plan.direct.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"changes": {
3434
"etag": {
3535
"action": "skip",
36+
"reason": "custom",
3637
"old": [ETAG],
3738
"remote": [ETAG]
3839
},
@@ -44,6 +45,7 @@
4445
},
4546
"serialized_dashboard": {
4647
"action": "skip",
48+
"reason": "custom",
4749
"old": "{\"pages\":[{\"displayName\":\"Test Dashboard\",\"name\":\"test-page\"}]}",
4850
"new": "{\"pages\":[{\"displayName\":\"Test Dashboard\",\"name\":\"test-page\"}]}",
4951
"remote": "{\"pages\":[{\"displayName\":\"Test Dashboard\",\"name\":\"test-page\",\"pageType\":\"PAGE_TYPE_CANVAS\"}]}"

bundle/deployplan/plan.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ const (
106106
ReasonEmptySlice = "empty_slice"
107107
ReasonEmptyMap = "empty_map"
108108
ReasonEmptyStruct = "empty_struct"
109+
ReasonCustom = "custom"
109110
)
110111

111112
// HasChange checks if there are any changes for fields with the given prefix.

0 commit comments

Comments
 (0)