|
7 | 7 | "testing" |
8 | 8 |
|
9 | 9 | "github.com/cloudquery/cloudquery/plugins/source/aws/client/mocks" |
| 10 | + "github.com/cloudquery/cloudquery/plugins/source/aws/client/spec" |
10 | 11 | "github.com/golang/mock/gomock" |
11 | 12 |
|
12 | 13 | "github.com/aws/aws-sdk-go-v2/aws" |
@@ -111,99 +112,99 @@ func Test_loadAccounts(t *testing.T) { |
111 | 112 | ctx := context.Background() |
112 | 113 | tests := []struct { |
113 | 114 | name string |
114 | | - spec *Spec |
| 115 | + spec *spec.Spec |
115 | 116 | want []string |
116 | 117 | wantErr error |
117 | 118 | }{ |
118 | 119 | { |
119 | 120 | name: "all_accounts", |
120 | | - spec: &Spec{ |
121 | | - Organization: &AwsOrg{ |
122 | | - AdminAccount: &Account{}, |
| 121 | + spec: &spec.Spec{ |
| 122 | + Organization: &spec.Org{ |
| 123 | + AdminAccount: &spec.Account{}, |
123 | 124 | }, |
124 | 125 | }, |
125 | 126 | want: []string{"id-child1-account", "id-child2-account", "id-parent1-account", "id-parent2-account", "id-top-level-account"}, |
126 | 127 | }, |
127 | 128 | { |
128 | 129 | name: "all_accounts_with_skip_member_accounts", |
129 | | - spec: &Spec{ |
130 | | - Organization: &AwsOrg{ |
131 | | - AdminAccount: &Account{}, |
| 130 | + spec: &spec.Spec{ |
| 131 | + Organization: &spec.Org{ |
| 132 | + AdminAccount: &spec.Account{}, |
132 | 133 | SkipMemberAccounts: []string{"id-child2-account", "id-parent1-account", "id-parent2-account", "id-top-level-account"}, |
133 | 134 | }, |
134 | 135 | }, |
135 | 136 | want: []string{"id-child1-account"}, |
136 | 137 | }, |
137 | 138 | { |
138 | 139 | name: "org_root", |
139 | | - spec: &Spec{ |
140 | | - Organization: &AwsOrg{ |
| 140 | + spec: &spec.Spec{ |
| 141 | + Organization: &spec.Org{ |
141 | 142 | OrganizationUnits: []string{"root"}, |
142 | | - AdminAccount: &Account{}, |
| 143 | + AdminAccount: &spec.Account{}, |
143 | 144 | }, |
144 | 145 | }, |
145 | 146 | want: []string{"id-top-level-account", "id-child1-account", "id-parent1-account", "id-child2-account", "id-parent2-account"}, |
146 | 147 | }, |
147 | 148 | { |
148 | 149 | name: "ou_parent1", |
149 | | - spec: &Spec{ |
150 | | - Organization: &AwsOrg{ |
| 150 | + spec: &spec.Spec{ |
| 151 | + Organization: &spec.Org{ |
151 | 152 | OrganizationUnits: []string{"ou-parent1"}, |
152 | | - AdminAccount: &Account{}, |
| 153 | + AdminAccount: &spec.Account{}, |
153 | 154 | }, |
154 | 155 | }, |
155 | 156 | want: []string{"id-parent1-account", "id-child1-account"}, |
156 | 157 | }, |
157 | 158 | { |
158 | 159 | name: "ou_parent1_and_parent2", |
159 | | - spec: &Spec{ |
160 | | - Organization: &AwsOrg{ |
| 160 | + spec: &spec.Spec{ |
| 161 | + Organization: &spec.Org{ |
161 | 162 | OrganizationUnits: []string{"ou-parent1", "ou-parent2"}, |
162 | | - AdminAccount: &Account{}, |
| 163 | + AdminAccount: &spec.Account{}, |
163 | 164 | }, |
164 | 165 | }, |
165 | 166 | want: []string{"id-parent1-account", "id-child1-account", "id-parent2-account", "id-child2-account"}, |
166 | 167 | }, |
167 | 168 | { |
168 | 169 | name: "ou_parent1_skip_child1", |
169 | | - spec: &Spec{ |
170 | | - Organization: &AwsOrg{ |
| 170 | + spec: &spec.Spec{ |
| 171 | + Organization: &spec.Org{ |
171 | 172 | OrganizationUnits: []string{"ou-parent1"}, |
172 | 173 | SkipMemberAccounts: []string{"id-child1-account"}, |
173 | | - AdminAccount: &Account{}, |
| 174 | + AdminAccount: &spec.Account{}, |
174 | 175 | }, |
175 | 176 | }, |
176 | 177 | want: []string{"id-parent1-account"}, |
177 | 178 | }, |
178 | 179 | { |
179 | 180 | name: "ou_root_skip_parent1", |
180 | | - spec: &Spec{ |
181 | | - Organization: &AwsOrg{ |
| 181 | + spec: &spec.Spec{ |
| 182 | + Organization: &spec.Org{ |
182 | 183 | OrganizationUnits: []string{"root"}, |
183 | 184 | SkipOrganizationalUnits: []string{"ou-parent1"}, |
184 | | - AdminAccount: &Account{}, |
| 185 | + AdminAccount: &spec.Account{}, |
185 | 186 | }, |
186 | 187 | }, |
187 | 188 | want: []string{"id-top-level-account", "id-parent2-account", "id-child2-account"}, |
188 | 189 | }, |
189 | 190 | { |
190 | 191 | name: "ou_root_skip_parent1", |
191 | | - spec: &Spec{ |
192 | | - Organization: &AwsOrg{ |
| 192 | + spec: &spec.Spec{ |
| 193 | + Organization: &spec.Org{ |
193 | 194 | OrganizationUnits: []string{"root"}, |
194 | 195 | SkipOrganizationalUnits: []string{"ou-parent1"}, |
195 | | - AdminAccount: &Account{}, |
| 196 | + AdminAccount: &spec.Account{}, |
196 | 197 | }, |
197 | 198 | }, |
198 | 199 | want: []string{"id-top-level-account", "id-parent2-account", "id-child2-account"}, |
199 | 200 | }, |
200 | 201 | { |
201 | 202 | name: "ou_root_and_parent1", |
202 | | - spec: &Spec{ |
203 | | - Organization: &AwsOrg{ |
| 203 | + spec: &spec.Spec{ |
| 204 | + Organization: &spec.Org{ |
204 | 205 | OrganizationUnits: []string{"root", "ou-parent1"}, |
205 | 206 | SkipOrganizationalUnits: []string{}, |
206 | | - AdminAccount: &Account{}, |
| 207 | + AdminAccount: &spec.Account{}, |
207 | 208 | }, |
208 | 209 | }, |
209 | 210 | want: []string{"id-top-level-account", "id-parent1-account", "id-child1-account", "id-parent2-account", "id-child2-account"}, |
|
0 commit comments