@@ -29,17 +29,66 @@ void listDependency(@TempDir Path workingDirectory) throws Exception {
2929 dependencies:
3030 - name: keycloakx
3131 repository: https://codecentric.github.io/helm-charts
32- version: "2.3.0"
32+ version: "2.3.0"
33+ - name: external-secrets
34+ version: 0.20.2
35+ repository: "https://charts.external-secrets.io/"
36+ - name: cert-manager
37+ repository: https://charts.jetstack.io/
38+ version: v1.17.2
3339 """ ,
3440 StandardOpenOption .CREATE , StandardOpenOption .TRUNCATE_EXISTING );
3541
42+
43+ // Copy test charts to working directory
44+ var classLoader = getClass ().getClassLoader ();
45+ var resource = classLoader .getResource ("com/contentgrid/helm/impl/list-dependency/charts" );
46+ Assertions .assertThat (resource ).isNotNull ();
47+
48+ Path sourceChartsDir = Path .of (resource .toURI ());
49+ Path targetChartsDir = workingDirectory .resolve ("charts" );
50+ Files .createDirectories (targetChartsDir );
51+
52+ try (var files = Files .list (sourceChartsDir )) {
53+ files .filter (path -> path .toString ().endsWith (".tgz" ))
54+ .forEach (sourcePath -> {
55+ try {
56+ Path targetPath = targetChartsDir .resolve (sourcePath .getFileName ());
57+ Files .copy (sourcePath , targetPath );
58+ } catch (Exception e ) {
59+ throw new RuntimeException ("Failed to copy chart: " + sourcePath , e );
60+ }
61+ });
62+ }
63+
64+
3665 var result = helm .dependency ().list ();
3766
38- Assertions .assertThat (result ).singleElement ().satisfies (dep -> {
39- Assertions .assertThat (dep .name ()).isEqualTo ("keycloakx" );
40- Assertions .assertThat (dep .repository ()).isEqualTo (URI .create ("https://codecentric.github.io/helm-charts" ));
41- Assertions .assertThat (dep .version ()).isEqualTo ("2.3.0" );
42- });
67+ Assertions .assertThat (result )
68+ .hasSize (3 )
69+ .satisfiesExactlyInAnyOrder (
70+ dep -> {
71+ Assertions .assertThat (dep .name ()).isEqualTo ("keycloakx" );
72+ Assertions .assertThat (dep .repository ())
73+ .isEqualTo (URI .create ("https://codecentric.github.io/helm-charts" ));
74+ Assertions .assertThat (dep .version ()).isEqualTo ("2.3.0" );
75+ Assertions .assertThat (dep .status ()).isEqualTo ("missing" );
76+ },
77+ dep -> {
78+ Assertions .assertThat (dep .name ()).isEqualTo ("external-secrets" );
79+ Assertions .assertThat (dep .repository ())
80+ .isEqualTo (URI .create ("https://charts.external-secrets.io/" ));
81+ Assertions .assertThat (dep .version ()).isEqualTo ("0.20.2" );
82+ Assertions .assertThat (dep .status ()).isEqualTo ("wrong version" );
83+ },
84+ dep -> {
85+ Assertions .assertThat (dep .name ()).isEqualTo ("cert-manager" );
86+ Assertions .assertThat (dep .repository ())
87+ .isEqualTo (URI .create ("https://charts.jetstack.io/" ));
88+ Assertions .assertThat (dep .version ()).isEqualTo ("v1.17.2" );
89+ Assertions .assertThat (dep .status ()).isEqualTo ("ok" );
90+ }
91+ );
4392 }
4493
4594}
0 commit comments