Skip to content

Commit

Permalink
Catalog : fix maintainers (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
olevitt authored Oct 3, 2023
1 parent a2ebf4c commit 7053feb
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
import fr.insee.onyxia.api.configuration.CatalogWrapper;
import fr.insee.onyxia.api.configuration.CustomObjectMapper;
import fr.insee.onyxia.api.util.TestUtils;
import fr.insee.onyxia.model.helm.Chart;
import java.util.List;
import java.util.stream.Collectors;
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;
import org.springframework.util.CollectionUtils;

@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = {CatalogLoader.class, CustomObjectMapper.class})
Expand Down Expand Up @@ -49,6 +52,27 @@ public void excludeChartTest() {
.noneMatch(p -> p.getName().equalsIgnoreCase("excludeme")));
}

@Test
public void loadMaintainers() {
CatalogWrapper cw = new CatalogWrapper();
cw.setType("helm");
cw.setLocation("classpath:/catalog-loader-test");
cw.setExcludedCharts(List.of("excludemetoo", "excludeme"));
catalogLoader.updateCatalog(cw);
List<List<Chart.Maintainer>> maintainers =
cw.getCatalog().getPackages().stream()
.map(p -> ((Chart) p).getMaintainers())
.collect(Collectors.toList());
assertThat(
"Maintainers have been loaded",
maintainers.stream()
.filter(l -> !CollectionUtils.isEmpty(l))
.anyMatch(
l ->
l.get(0).getName().equals("test")
&& l.get(0).getEmail().equals("[email protected]")));
}

@DisplayName(
"Given a helm catalog wrapper with local charts and excluded charts, "
+ "when we update the catalog, "
Expand Down
179 changes: 91 additions & 88 deletions onyxia-api/src/test/resources/catalog-loader-test/index.yaml
Original file line number Diff line number Diff line change
@@ -1,93 +1,96 @@
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
- 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
maintainers:
- email: [email protected]
name: test
- 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
- 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

13 changes: 0 additions & 13 deletions onyxia-api/src/test/resources/multiverse.json

This file was deleted.

15 changes: 0 additions & 15 deletions onyxia-api/src/test/resources/sample-helm.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}

private class Maintainer {
public static class Maintainer {
@JsonProperty("email")
private String email;

Expand Down

0 comments on commit 7053feb

Please sign in to comment.