Commit 84353f5
Add comprehensive HCP full backup/restore test suite with existing cluster support
This commit introduces a complete HCP (Hosted Control Plane) backup and restore testing framework
with support for both newly created and existing HostedCluster environments.
## Key Features Added:
### New Test Infrastructure
- Add `hcp_full_backup_restore_suite_test.go`: Complete test suite for full HCP backup/restore scenarios
- Support for two operational modes:
- `create`: Creates new HostedCluster for testing (existing behavior)
- `existing`: Uses pre-existing HostedCluster with data plane
### Enhanced Configuration Options
- Add Makefile variables for HCP test configuration:
- `HC_BACKUP_RESTORE_MODE`: Controls test execution mode (create/existing)
- `HC_NAME`: Specifies HostedCluster name for existing mode
- `HC_KUBECONFIG`: Path to guest cluster kubeconfig for existing mode
- Pass HCP configuration parameters to e2e test execution
### Improved Test Architecture
- Refactor `runHCPBackupAndRestore()` function for unified handling of both modes
- Add guest cluster verification functions (`PreBackupVerifyGuest`, `PostRestoreVerifyGuest`)
- Separate log gathering and DPA resource cleanup into reusable functions
- Enhanced error handling and validation for both control plane and guest cluster
### Guest Cluster Testing
- Add support for kubeconfig-based guest cluster operations
- Implement pre/post backup verification for guest cluster resources
- Add namespace creation/validation tests for guest cluster functionality
### Library Enhancements
- Add `GetHostedCluster()` method to retrieve existing HostedCluster objects
- Add `ClientGuest` field to `HCHandler` for guest cluster operations
- Improve error message formatting in DPA helpers
### Documentation Updates
- Add comprehensive testing documentation for HCP scenarios
- Include examples for running tests against existing HostedControlPlane
- Document environment variable configuration options
### Build System Improvements
- Add conditional must-gather build based on `SKIP_MUST_GATHER` flag
- Enhanced e2e test parameter passing for HCP configurations
## Technical Implementation:
The implementation supports testing both scenarios where OADP needs to:
1. Create a new HostedCluster and test backup/restore (existing functionality)
2. Work with an existing HostedCluster that already has workloads and data plane
This enables comprehensive testing of HCP backup/restore functionality in realistic
production-like environments where clusters already exist and contain user workloads.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>1 parent c354db6 commit 84353f5
File tree
9 files changed
+271
-32
lines changed- docs/developer/testing
- tests/e2e
- lib
- hcp
9 files changed
+271
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
67 | 77 | | |
68 | 78 | | |
69 | 79 | | |
| |||
769 | 779 | | |
770 | 780 | | |
771 | 781 | | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
772 | 785 | | |
773 | 786 | | |
774 | 787 | | |
| |||
792 | 805 | | |
793 | 806 | | |
794 | 807 | | |
795 | | - | |
796 | 808 | | |
797 | 809 | | |
798 | 810 | | |
| |||
816 | 828 | | |
817 | 829 | | |
818 | 830 | | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
819 | 834 | | |
| 835 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
102 | 113 | | |
103 | 114 | | |
104 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
240 | 241 | | |
241 | 242 | | |
242 | 243 | | |
| |||
255 | 256 | | |
256 | 257 | | |
257 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
258 | 263 | | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
| 264 | + | |
264 | 265 | | |
265 | 266 | | |
266 | 267 | | |
| |||
270 | 271 | | |
271 | 272 | | |
272 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
273 | 283 | | |
274 | | - | |
| 284 | + | |
| 285 | + | |
275 | 286 | | |
276 | | - | |
| 287 | + | |
277 | 288 | | |
278 | 289 | | |
279 | 290 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
28 | | - | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| 42 | + | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
43 | | - | |
44 | | - | |
45 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
| |||
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
62 | 70 | | |
63 | 71 | | |
64 | 72 | | |
| |||
115 | 123 | | |
116 | 124 | | |
117 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
118 | 137 | | |
119 | 138 | | |
120 | 139 | | |
| |||
123 | 142 | | |
124 | 143 | | |
125 | 144 | | |
| 145 | + | |
126 | 146 | | |
127 | 147 | | |
128 | 148 | | |
129 | 149 | | |
130 | 150 | | |
131 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
132 | 160 | | |
133 | 161 | | |
134 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
135 | 166 | | |
136 | 167 | | |
137 | 168 | | |
| |||
200 | 231 | | |
201 | 232 | | |
202 | 233 | | |
203 | | - | |
204 | 234 | | |
205 | 235 | | |
206 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 17 | + | |
21 | 18 | | |
22 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
23 | 32 | | |
| 33 | + | |
24 | 34 | | |
25 | 35 | | |
26 | 36 | | |
| |||
29 | 39 | | |
30 | 40 | | |
31 | 41 | | |
32 | | - | |
| 42 | + | |
33 | 43 | | |
34 | 44 | | |
35 | | - | |
36 | 45 | | |
37 | | - | |
38 | | - | |
39 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
40 | 62 | | |
41 | | - | |
| 63 | + | |
| 64 | + | |
42 | 65 | | |
43 | 66 | | |
44 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
45 | 77 | | |
46 | 78 | | |
47 | 79 | | |
| |||
59 | 91 | | |
60 | 92 | | |
61 | 93 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
66 | 120 | | |
67 | 121 | | |
68 | 122 | | |
| |||
78 | 132 | | |
79 | 133 | | |
80 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
81 | 139 | | |
82 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
83 | 144 | | |
84 | 145 | | |
85 | 146 | | |
| |||
124 | 185 | | |
125 | 186 | | |
126 | 187 | | |
127 | | - | |
| 188 | + | |
128 | 189 | | |
129 | 190 | | |
130 | 191 | | |
131 | 192 | | |
| 193 | + | |
132 | 194 | | |
133 | 195 | | |
134 | 196 | | |
| |||
142 | 204 | | |
143 | 205 | | |
144 | 206 | | |
| 207 | + | |
145 | 208 | | |
146 | 209 | | |
147 | 210 | | |
| |||
0 commit comments