@@ -4,65 +4,81 @@ End-to-end tests for the `d8 mirror pull` and `d8 mirror push` commands.
44
55## Overview
66
7- These tests perform a ** complete mirror cycle with deep comparison** to ensure source and target registries are ** 100% identical** .
7+ These tests perform ** complete mirror cycles with verification** to ensure:
8+ 1 . All expected images are downloaded from source
9+ 2 . All images are correctly pushed to target registry
10+ 3 . All images match between source and target (deep comparison)
11+
12+ ## Test Types
13+
14+ | Test | Description | Timeout | Command |
15+ | ------| -------------| ---------| ---------|
16+ | ** Full Cycle** | Platform + Modules + Security | 3h | ` task test:e2e:mirror:fullcycle ` |
17+ | ** Platform** | Deckhouse core only | 2h | ` task test:e2e:mirror:platform ` |
18+ | ** Platform Stable** | Only stable channel | 1h | ` task test:e2e:mirror:platform:stable ` |
19+ | ** Modules** | All modules | 2h | ` task test:e2e:mirror:modules ` |
20+ | ** Single Module** | One module (fast) | 30m | ` task test:e2e:mirror:modules:single ` |
21+ | ** Security** | Security DBs only | 30m | ` task test:e2e:mirror:security ` |
22+
23+ ## Verification Approach
24+
25+ ### Step 1: Read Expected Images from Source
26+ Before pulling, we independently read what SHOULD be downloaded:
27+ - Release channel versions from source registry
28+ - ` images_digests.json ` from each installer image
29+ - Module list and versions
30+
31+ ### Step 2: Pull & Push
32+ Execute ` d8 mirror pull ` and ` d8 mirror push `
33+
34+ ### Step 3: Verify
35+ Compare expected images with what's actually in target:
36+ - All expected digests must exist in target
37+ - All images in target must match source (manifest, config, layers)
38+
39+ This catches:
40+ - ** Pull bugs** - if pull forgets to download an image
41+ - ** Push bugs** - if push fails to upload an image
42+ - ** Data corruption** - if any digest doesn't match
843
9- ### Test Steps
10-
11- 1 . ** Analyze source registry** - Discover all repositories and count all images
12- 2 . ** Pull images** - Execute ` d8 mirror pull ` to create a bundle
13- 3 . ** Push images** - Execute ` d8 mirror push ` to target registry
14- 4 . ** Deep comparison** - Compare every repository, tag, and digest between source and target
15-
16- ### What Gets Compared (Deep Comparison)
17-
18- - ** Repository level** : All repositories in source must exist in target
19- - ** Tag level** : All tags in each repository must exist in target
20- - ** Manifest digest** : Every image manifest digest must match (SHA256)
21- - ** Config digest** : Image config blob digest is verified
22- - ** Layer digests** : ALL layer digests of every image are compared
23- - ** Layer count** : Number of layers must match
44+ ## Running Tests
2445
25- This ensures ** byte-for-byte identical ** registries.
46+ ### Quick Start
2647
27- ## Requirements
48+ ``` bash
49+ # Full cycle with license token
50+ E2E_LICENSE_TOKEN=xxx task test:e2e:mirror:fullcycle
2851
29- - Built ` d8 ` binary (run ` task build ` from project root)
30- - Valid credentials for the source registry
31- - Network access to the source registry
32- - Sufficient disk space for the bundle (can be ~ 20 GB)
52+ # Platform only (faster)
53+ E2E_LICENSE_TOKEN=xxx task test:e2e:mirror:platform:stable
3354
34- ## Running Tests
55+ # Single module (fastest)
56+ E2E_LICENSE_TOKEN=xxx task test:e2e:mirror:modules:single
57+ ```
3558
36- ### Using Taskfile (Recommended)
59+ ### Using Environment Variables
3760
3861``` bash
39- # With environment variables
62+ # Official registry with license
63+ E2E_LICENSE_TOKEN=your_license_token \
64+ task test:e2e:mirror:fullcycle
65+
66+ # Local registry
4067E2E_SOURCE_REGISTRY=localhost:443/deckhouse \
4168E2E_SOURCE_USER=admin \
4269E2E_SOURCE_PASSWORD=secret \
4370E2E_TLS_SKIP_VERIFY=true \
44- task test:e2e:mirror
71+ task test:e2e:mirror:platform
4572
46- # With command-line flags
47- task test:e2e:mirror -- \
48- -source-registry=localhost:443/deckhouse \
49- -source-user=admin \
50- -source-password=admin \
51- -tls-skip-verify
73+ # Specific release channel
74+ E2E_LICENSE_TOKEN=xxx \
75+ E2E_DECKHOUSE_TAG=stable \
76+ task test:e2e:mirror:platform
5277
53- # With license token (official Deckhouse registry)
54- E2E_LICENSE_TOKEN=xxx task test:e2e:mirror
55- ```
56-
57- ### Using go test directly
58-
59- ``` bash
60- # Note: requires -tags=e2e flag
61- go test -v -tags=e2e -timeout=120m ./testing/e2e/mirror/... \
62- -source-registry=localhost:443/deckhouse \
63- -source-user=admin \
64- -source-password=secret \
65- -tls-skip-verify
78+ # Specific modules only
79+ E2E_LICENSE_TOKEN=xxx \
80+ E2E_INCLUDE_MODULES=" pod-reloader,neuvector" \
81+ task test:e2e:mirror:modules
6682```
6783
6884### Configuration Options
@@ -73,20 +89,25 @@ go test -v -tags=e2e -timeout=120m ./testing/e2e/mirror/... \
7389| ` -source-user ` | ` E2E_SOURCE_USER ` | | Source registry username |
7490| ` -source-password ` | ` E2E_SOURCE_PASSWORD ` | | Source registry password |
7591| ` -license-token ` | ` E2E_LICENSE_TOKEN ` | | License token |
76- | ` -target-registry ` | ` E2E_TARGET_REGISTRY ` | (local disk-based registry ) | Target registry |
92+ | ` -target-registry ` | ` E2E_TARGET_REGISTRY ` | (in-memory ) | Target registry |
7793| ` -target-user ` | ` E2E_TARGET_USER ` | | Target registry username |
7894| ` -target-password ` | ` E2E_TARGET_PASSWORD ` | | Target registry password |
7995| ` -tls-skip-verify ` | ` E2E_TLS_SKIP_VERIFY ` | ` false ` | Skip TLS verification |
96+ | ` -deckhouse-tag ` | ` E2E_DECKHOUSE_TAG ` | | Specific tag/channel (e.g., ` stable ` , ` v1.65.8 ` ) |
97+ | ` -no-modules ` | ` E2E_NO_MODULES ` | ` false ` | Skip modules |
98+ | ` -no-platform ` | ` E2E_NO_PLATFORM ` | ` false ` | Skip platform |
99+ | ` -no-security ` | ` E2E_NO_SECURITY ` | ` false ` | Skip security DBs |
100+ | ` -include-modules ` | ` E2E_INCLUDE_MODULES ` | | Comma-separated module list |
80101| ` -keep-bundle ` | ` E2E_KEEP_BUNDLE ` | ` false ` | Keep bundle after test |
81102| ` -d8-binary ` | ` E2E_D8_BINARY ` | ` bin/d8 ` | Path to d8 binary |
82- | ` -new-pull ` | ` E2E_NEW_PULL ` | ` false ` | Use new pull implementation |
103+ | ` -new-pull ` | ` E2E_NEW_PULL ` | ` false ` | Use experimental pull |
83104
84105## Test Artifacts
85106
86- Tests produce detailed artifacts in ` testing/e2e/.logs/<test>-<timestamp>/ ` :
107+ Tests produce artifacts in ` testing/e2e/.logs/<test>-<timestamp>/ ` :
87108
88109```
89- testing/e2e/.logs/fullcycle -20251226-114128/
110+ testing/e2e/.logs/TestFullCycleE2E -20251226-114128/
90111├── test.log # Full command output (pull/push)
91112├── report.txt # Test summary report
92113└── comparison.txt # Detailed registry comparison
@@ -98,128 +119,57 @@ testing/e2e/.logs/fullcycle-20251226-114128/
98119task test:e2e:mirror:logs:clean
99120```
100121
101- ### Sample Report (report.txt)
102-
103- ```
104- ================================================================================
105- E2E TEST REPORT: TestMirrorE2E_FullCycle
106- ================================================================================
107-
108- EXECUTION:
109- Started: 2025-12-26T11:41:28+03:00
110- Finished: 2025-12-26T11:46:28+03:00
111- Duration: 5m1s
112-
113- REGISTRIES:
114- Source: localhost:443/deckhouse-etalon
115- Target: 127.0.0.1:61594/deckhouse/ee
116-
117- IMAGES TO VERIFY:
118- Source: 324 images (82 repos)
119- Target: 324 images (82 repos)
120- (excluded 1071 internal tags from comparison)
121-
122- BUNDLE:
123- Size: 22.52 GB
124-
125- VERIFICATION RESULTS:
126- Images matched: 324 (manifest + config + layers)
127- Layers verified: 1172
128- Missing images: 0
129- Digest mismatch: 0
130- Missing layers: 0
131-
132- STEPS:
133- [PASS] Analyze source (82 repos) (330ms)
134- [PASS] Pull images (22.52 GB bundle) (2m59.826s)
135- [PASS] Push to registry (1m57.742s)
136- [PASS] Deep comparison (324 images verified) (2.266s)
137-
138- ================================================================================
139- RESULT: PASSED - REGISTRIES ARE IDENTICAL
140- 82 repositories verified
141- 324 images verified
142- ================================================================================
143- ```
122+ ## Requirements
144123
145- ### Comparison Report (comparison.txt)
124+ - Built ` d8 ` binary (run ` task build ` )
125+ - Valid credentials for source registry
126+ - Network access
127+ - Disk space for bundle (20-50 GB depending on scope)
146128
147- Contains detailed breakdown per repository with layer-level verification:
129+ ## What Gets Verified
148130
149- ```
150- REGISTRY COMPARISON SUMMARY
151- ===========================
152-
153- Source: localhost:443/deckhouse
154- Target: 127.0.0.1:54321/deckhouse/ee
155- Duration: 2s
156-
157- REPOSITORIES:
158- Source: 82
159- Target: 82
160- Missing in target: 0
161- Extra in target: 0
162-
163- IMAGES TO VERIFY:
164- Source: 324 images
165- Target: 324 images
166- (excluded 1071 internal tags: digest-based, .att, .sig)
167-
168- VERIFICATION RESULTS:
169- Matched: 324
170- DEEP COMPARISON (layers + config):
171- Images deep-checked: 324
172- Source layers: 1172
173- Target layers: 1172
174- Matched layers: 1172
175- Missing layers: 0
176- Config mismatches: 0
177-
178- ✓ REGISTRIES ARE IDENTICAL (all hashes match)
179-
180- REPOSITORY BREAKDOWN:
181- ---------------------
182- ✓ (root): 6/6 tags, 66 layers checked
183- ✓ install: 6/6 tags, 48 layers checked
184- ✓ install-standalone: 78/78 tags, 624 layers checked
185- ✓ release-channel: 6/6 tags, 12 layers checked
186- ✓ security/trivy-db: 1/1 tags, 2 layers checked
187- ✓ modules/deckhouse-admin: 5/5 tags, 10 layers checked
188- ...
189- ```
131+ ### Platform Test
132+ 1 . Release channels exist (alpha, beta, stable, rock-solid)
133+ 2 . Install images for each version
134+ 3 . All digests from ` images_digests.json ` exist in target
190135
191- ## Timeouts
136+ ### Modules Test
137+ 1 . Module list matches expected
138+ 2 . Each module has release tags
139+ 3 . Module images match source
192140
193- The test has a ** 120-minute timeout** to handle large registries.
141+ ### Security Test
142+ 1 . All security databases exist (trivy-db, trivy-bdu, etc.)
143+ 2 . Tags match source
194144
195145## Troubleshooting
196146
197147### "Source authentication not provided"
198-
199- Set credentials:
200148``` bash
201- E2E_LICENSE_TOKEN=your_token task test:e2e:mirror
202- # or
203- E2E_SOURCE_USER=admin E2E_SOURCE_PASSWORD=secret task test:e2e:mirror
149+ E2E_LICENSE_TOKEN=your_token task test:e2e:mirror:fullcycle
204150```
205151
206- ### "Pull failed" or "Push failed"
207-
208- 1 . Check ` d8 ` binary exists (` task build ` )
152+ ### "Pull failed"
153+ 1 . Check ` d8 ` binary: ` task build `
2091542 . Check network access
210- 3 . Use ` -tls-skip-verify ` for self-signed certs
211- 4 . Check credentials
155+ 3 . For self-signed certs: ` E2E_TLS_SKIP_VERIFY=true `
212156
213- ### "Registries differ"
214-
215- Check ` comparison.txt ` for details:
216- - ** Missing images** : Images in source but not in target
217- - ** Mismatched digests** : Images exist but have different content
218-
219- ### Viewing Bundle Contents
157+ ### "Verification failed"
158+ Check ` comparison.txt ` :
159+ - ** Missing in target** : Pull or push didn't transfer the image
160+ - ** Digest mismatch** : Data corruption or version skew
220161
162+ ### Running Against Local Registry
221163``` bash
222- E2E_KEEP_BUNDLE=true task test:e2e:mirror -- ...
164+ E2E_SOURCE_REGISTRY=localhost:5000/deckhouse \
165+ E2E_SOURCE_USER=admin \
166+ E2E_SOURCE_PASSWORD=admin \
167+ E2E_TLS_SKIP_VERIFY=true \
168+ task test:e2e:mirror:platform
169+ ```
223170
224- # Bundle location shown in output
171+ ### Keep Bundle for Debugging
172+ ``` bash
173+ E2E_KEEP_BUNDLE=true E2E_LICENSE_TOKEN=xxx task test:e2e:mirror:platform:stable
174+ # Bundle location shown in test output
225175```
0 commit comments