-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix excluded charts are downloaded for entries
Signed-off-by: CChemin <[email protected]>
- Loading branch information
Showing
4 changed files
with
154 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
onyxia-api/src/test/java/fr/insee/onyxia/api/dao/universe/CatalogLoaderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package fr.insee.onyxia.api.dao.universe; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
import fr.insee.onyxia.api.configuration.CatalogWrapper; | ||
import fr.insee.onyxia.api.configuration.CustomObjectMapper; | ||
import java.util.List; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
|
||
@ExtendWith(SpringExtension.class) | ||
@SpringBootTest(classes = {CatalogLoader.class, CustomObjectMapper.class}) | ||
public class CatalogLoaderTest { | ||
|
||
@Autowired CatalogLoader catalogLoader; | ||
|
||
@DisplayName( | ||
"Given a helm catalog wrapper with local charts and excluded charts, " | ||
+ "when we update the catalog, " | ||
+ "then the excluded chart is not set") | ||
@Test | ||
public void excludeChartTest() { | ||
CatalogWrapper cw = new CatalogWrapper(); | ||
cw.setType("helm"); | ||
cw.setLocation("classpath:/catalog-loader-test"); | ||
cw.setExcludedCharts(List.of("excludemetoo", "excludeme")); | ||
catalogLoader.updateCatalog(cw); | ||
assertThat( | ||
"cw has the not excluded entries", | ||
cw.getCatalog().getEntries().get("keepme").size(), | ||
is(2)); | ||
assertThat( | ||
"cw has the not excluded package", | ||
cw.getCatalog().getPackages().stream() | ||
.anyMatch(p -> p.getName().equalsIgnoreCase("keepme"))); | ||
assertThat( | ||
"cw does not have the excluded entries", | ||
!cw.getCatalog().getEntries().containsKey("excludeme")); | ||
assertThat( | ||
"cw does not have the excluded packages", | ||
cw.getCatalog().getPackages().stream() | ||
.noneMatch(p -> p.getName().equalsIgnoreCase("excludeme"))); | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
onyxia-api/src/test/resources/catalog-loader-test/index.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
apiVersion: v1 | ||
entries: | ||
keepme: | ||
- apiVersion: v2 | ||
appVersion: "1" | ||
created: "2022-10-03T11:53:20.589754116Z" | ||
dependencies: | ||
- name: argo-cd | ||
repository: https://argoproj.github.io/argo-helm | ||
version: 4.9.11 | ||
- name: library-chart | ||
repository: https://inseefrlab.github.io/helm-charts-datascience | ||
version: 2.0.21 | ||
description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. | ||
digest: beedc71c7f5730cf68000b5665dd4da636e72a026edd9b12c1d048398d4166dd | ||
home: https://argo-cd.readthedocs.io/en/stable/ | ||
icon: https://minio.lab.sspcloud.fr/projet-onyxia/assets/servicesImg/argo.png | ||
name: keepme | ||
sources: | ||
- https://github.com/InseeFrLab/helm-charts-datascience/tree/master/charts/argo-cd | ||
- https://github.com/argoproj/argo-helm/tree/master/charts/argo-cd | ||
type: application | ||
urls: | ||
- keepeme1.gz | ||
version: 2.4.0 | ||
- apiVersion: v2 | ||
appVersion: "2" | ||
created: "2022-10-03T11:53:20.589754116Z" | ||
dependencies: | ||
- name: argo-cd | ||
repository: https://argoproj.github.io/argo-helm | ||
version: 4.9.11 | ||
- name: library-chart | ||
repository: https://inseefrlab.github.io/helm-charts-datascience | ||
version: 2.0.21 | ||
description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. | ||
digest: beedc71c7f5730cf68000b5665dd4da636e72a026edd9b12c1d048398d4166dd | ||
home: https://argo-cd.readthedocs.io/en/stable/ | ||
icon: https://minio.lab.sspcloud.fr/projet-onyxia/assets/servicesImg/argo.png | ||
name: keepme | ||
sources: | ||
- https://github.com/InseeFrLab/helm-charts-datascience/tree/master/charts/argo-cd | ||
- https://github.com/argoproj/argo-helm/tree/master/charts/argo-cd | ||
type: application | ||
urls: | ||
- keepeme2.gz | ||
version: 2.4.0 | ||
excludeme: | ||
- apiVersion: v2 | ||
appVersion: "1" | ||
created: "2022-10-03T11:53:20.589754116Z" | ||
dependencies: | ||
- name: argo-cd | ||
repository: https://argoproj.github.io/argo-helm | ||
version: 4.9.11 | ||
- name: library-chart | ||
repository: https://inseefrlab.github.io/helm-charts-datascience | ||
version: 2.0.21 | ||
description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. | ||
digest: beedc71c7f5730cf68000b5665dd4da636e72a026edd9b12c1d048398d4166dd | ||
home: https://argo-cd.readthedocs.io/en/stable/ | ||
icon: https://minio.lab.sspcloud.fr/projet-onyxia/assets/servicesImg/argo.png | ||
name: excludeme | ||
sources: | ||
- https://github.com/InseeFrLab/helm-charts-datascience/tree/master/charts/argo-cd | ||
- https://github.com/argoproj/argo-helm/tree/master/charts/argo-cd | ||
type: application | ||
urls: | ||
- excludeme1.gz | ||
version: 2.4.0 | ||
- apiVersion: v2 | ||
appVersion: "2" | ||
created: "2022-10-03T11:53:20.589754116Z" | ||
dependencies: | ||
- name: argo-cd | ||
repository: https://argoproj.github.io/argo-helm | ||
version: 4.9.11 | ||
- name: library-chart | ||
repository: https://inseefrlab.github.io/helm-charts-datascience | ||
version: 2.0.21 | ||
description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. | ||
digest: beedc71c7f5730cf68000b5665dd4da636e72a026edd9b12c1d048398d4166dd | ||
home: https://argo-cd.readthedocs.io/en/stable/ | ||
icon: https://minio.lab.sspcloud.fr/projet-onyxia/assets/servicesImg/argo.png | ||
name: excludeme | ||
sources: | ||
- https://github.com/InseeFrLab/helm-charts-datascience/tree/master/charts/argo-cd | ||
- https://github.com/argoproj/argo-helm/tree/master/charts/argo-cd | ||
type: application | ||
urls: | ||
- excludeme2.gz | ||
version: 2.4.0 | ||
|