Commit 959366b
authored
[Fix] RMS: Fix pagination and filter bugs in rms_policy_states_v1 data source (#3315)
[Fix] RMS: Fix pagination and filter bugs in rms_policy_states_v1 data source
Summary of the Pull Request
Fix two bugs in opentelekomcloud_rms_policy_states_v1 that caused incomplete and incorrect results in environments with paginated policy states:
Pagination: Bump gophertelekomcloud SDK which fixes marker-based pagination for RMS compliance (NewPageInfoBase replaces NewSinglePageBase in ListAllUserCompliance/ ListAllRuleCompliance). The old SDK short-circuited NewAllPages() after page 1.
Filtering: Pass compliance_state, resource_name, and resource_id as query parameters to the SDK calls for server-side filtering. Remove filterPolicyStates() which returned all unfiltered states when no match was found instead of an empty slice.
Also fixes pre-existing acceptance test issues:
Add missing filter_by_compliance_state data source block in HCL config
Add opentelekomcloud_rms_policy_assignment_evaluate_v1 to make the test self-contained
(no longer depends on pre-existing policy states)
Split into two test steps with 30s wait for evaluation to complete
PR Checklist
Refers to: #3316
Tests added/passed.
Documentation updated. (N/A — no schema or behavior change from user perspective)
Schema updated.
Release notes added.
Acceptance Steps Performed
Prerequisites: RMS Resource Recorder must be enabled on the test account.
=== RUN TestAccDataSourceRmsPolicyStates_basic
=== PAUSE TestAccDataSourceRmsPolicyStates_basic
=== CONT TestAccDataSourceRmsPolicyStates_basic
data_source_opentelekomcloud_rms_policy_states_v1_test.go:38: Waiting 30s for policy evaluation to complete...
--- PASS: TestAccDataSourceRmsPolicyStates_basic (269.36s)
PASS
Reviewed-by: Anton Sidelnikov
Reviewed-by: Tobias Wohland
Reviewed-by: Artem Lifshits1 parent 24ba784 commit 959366b
File tree
5 files changed
+58
-50
lines changed- opentelekomcloud
- acceptance/rms
- services/rms
- releasenotes/notes
5 files changed
+58
-50
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | | - | |
| 170 | + | |
| 171 | + | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| |||
Lines changed: 26 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
33 | 41 | | |
34 | 42 | | |
35 | 43 | | |
| |||
76 | 84 | | |
77 | 85 | | |
78 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
79 | 91 | | |
80 | 92 | | |
81 | 93 | | |
82 | 94 | | |
83 | 95 | | |
84 | 96 | | |
85 | 97 | | |
86 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
87 | 107 | | |
88 | 108 | | |
89 | 109 | | |
90 | 110 | | |
91 | | - | |
| 111 | + | |
92 | 112 | | |
93 | 113 | | |
94 | 114 | | |
95 | 115 | | |
| 116 | + | |
| 117 | + | |
96 | 118 | | |
97 | 119 | | |
98 | 120 | | |
99 | 121 | | |
| 122 | + | |
| 123 | + | |
100 | 124 | | |
101 | 125 | | |
102 | 126 | | |
| |||
Lines changed: 24 additions & 45 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
107 | 113 | | |
108 | | - | |
| 114 | + | |
109 | 115 | | |
110 | | - | |
111 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
112 | 121 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | 122 | | |
118 | 123 | | |
119 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
120 | 128 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
125 | 132 | | |
126 | 133 | | |
127 | | - | |
128 | | - | |
129 | | - | |
| 134 | + | |
130 | 135 | | |
131 | 136 | | |
132 | 137 | | |
133 | | - | |
| 138 | + | |
134 | 139 | | |
135 | 140 | | |
136 | 141 | | |
137 | | - | |
| 142 | + | |
138 | 143 | | |
139 | | - | |
140 | | - | |
| 144 | + | |
| 145 | + | |
141 | 146 | | |
142 | 147 | | |
143 | 148 | | |
| |||
161 | 166 | | |
162 | 167 | | |
163 | 168 | | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments