1
0
mirror of synced 2026-02-06 19:05:55 +00:00

Add unit tests for export

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
This commit is contained in:
Somtochi Onyekwere
2021-10-27 10:50:42 +01:00
parent 96aac387c9
commit eb69083ef5
14 changed files with 405 additions and 2 deletions

17
cmd/flux/testdata/export/alert.yaml vendored Normal file
View File

@@ -0,0 +1,17 @@
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Alert
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
eventSeverity: info
eventSources:
- kind: GitRepository
name: '*'
- kind: Kustomization
name: '*'
providerRef:
name: slack
summary: Slacktest Notification

14
cmd/flux/testdata/export/bucket.yaml vendored Normal file
View File

@@ -0,0 +1,14 @@
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: Bucket
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
bucketName: podinfo
endpoint: s3.amazonaws.com
interval: 5m0s
provider: aws
region: us-east-1
timeout: 30s

16
cmd/flux/testdata/export/git-repo.yaml vendored Normal file
View File

@@ -0,0 +1,16 @@
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
gitImplementation: go-git
interval: 5m0s
ref:
branch: main
secretRef:
name: flux-system
timeout: 20s
url: ssh://git@github.com/example/repo

View File

@@ -0,0 +1,18 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
chart:
spec:
chart: podinfo
reconcileStrategy: ChartVersion
sourceRef:
kind: HelmRepository
name: flux-systen
namespace: {{ .fluxns }}
version: '*'
interval: 5m0s

11
cmd/flux/testdata/export/helm-repo.yaml vendored Normal file
View File

@@ -0,0 +1,11 @@
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: HelmRepository
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
interval: 5m0s
timeout: 1m0s
url: https://stefanprodan.github.io/podinfo

View File

@@ -0,0 +1,13 @@
---
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImagePolicy
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
imageRepositoryRef:
name: flux-system
policy:
semver:
range: 5.0.x

View File

@@ -0,0 +1,10 @@
---
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImageRepository
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
image: ghcr.io/test/podinfo
interval: 1m0s

View File

@@ -0,0 +1,20 @@
---
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImageUpdateAutomation
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
git:
commit:
author:
email: fluxcdbot@users.noreply.github.com
name: fluxcdbot
interval: 1m0s
sourceRef:
kind: GitRepository
name: flux-system
update:
path: ./clusters/my-cluster
strategy: Setters

14
cmd/flux/testdata/export/ks.yaml vendored Normal file
View File

@@ -0,0 +1,14 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
interval: 5m0s
path: ./infrastructure/
prune: true
sourceRef:
kind: GitRepository
name: flux-system

153
cmd/flux/testdata/export/objects.yaml vendored Normal file
View File

@@ -0,0 +1,153 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: {{ .fluxns }}
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Provider
metadata:
name: slack
namespace: {{ .fluxns }}
spec:
type: slack
channel: 'A channel with spacess'
address: https://hooks.slack.com/services/mock
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Alert
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
summary: "Slacktest Notification"
providerRef:
name: slack
eventSeverity: info
eventSources:
- kind: "GitRepository"
name: "*"
- kind: "Kustomization"
name: "*"
---
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImageRepository
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
image: ghcr.io/test/podinfo
interval: 1m0s
---
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImagePolicy
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
imageRepositoryRef:
name: flux-system
policy:
semver:
range: 5.0.x
---
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImageUpdateAutomation
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
interval: 1m0s
sourceRef:
kind: GitRepository
name: flux-system
git:
commit:
author:
email: fluxcdbot@users.noreply.github.com
name: fluxcdbot
messageTemplate: '{{range .Updated.Images}}{{println .}}{{end}}'
update:
path: ./clusters/my-cluster
strategy: Setters
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
ref:
branch: main
secretRef:
name: flux-system
interval: 5m
url: ssh://git@github.com/example/repo
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
kind: Kustomization
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
path: ./infrastructure/
sourceRef:
kind: GitRepository
name: flux-system
interval: 5m
prune: true
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Receiver
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
type: github
events:
- "ping"
- "push"
secretRef:
name: webhook-token
resources:
- kind: GitRepository
name: flux-system
namespace: flux-system
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: HelmRepository
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
interval: 5m
timeout: 1m0s
url: https://stefanprodan.github.io/podinfo
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
interval: 5m
chart:
spec:
chart: podinfo
sourceRef:
kind: HelmRepository
name: flux-systen
namespace: {{ .fluxns }}
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: Bucket
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
interval: 5m
provider: aws
bucketName: podinfo
endpoint: s3.amazonaws.com
region: us-east-1
timeout: 30s

11
cmd/flux/testdata/export/provider.yaml vendored Normal file
View File

@@ -0,0 +1,11 @@
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Provider
metadata:
name: slack
namespace: {{ .fluxns }}
spec:
address: https://hooks.slack.com/services/mock
channel: A channel with spacess
type: slack

18
cmd/flux/testdata/export/receiver.yaml vendored Normal file
View File

@@ -0,0 +1,18 @@
---
apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Receiver
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
events:
- ping
- push
resources:
- kind: GitRepository
name: flux-system
namespace: flux-system
secretRef:
name: webhook-token
type: github