Skip to content

🌱 Add regression testing to rukpak/convert #1895

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/convert-diff.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: bundle-convert-diff
on:
pull_request:
jobs:
bundle-convert-diff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Run make verify-convert
run: make verify-convert
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyI
verify: tidy fmt generate manifests crd-ref-docs #HELP Verify all generated code is up-to-date.
git diff --exit-code

.PHONY: verify-convert
verify-convert:
go run test/convert/generate-manifests.go
git diff --exit-code

.PHONY: fix-lint
fix-lint: $(GOLANGCI_LINT) #EXHELP Fix lint issues
$(GOLANGCI_LINT) run --fix --build-tags $(GO_BUILD_TAGS) $(GOLANGCI_LINT_ARGS)
Expand Down
7 changes: 7 additions & 0 deletions test/convert/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## registry+v1 bundle generation regression tests

This directory includes test cases for the rukpak/convert package based on real bundle data.
The manifests are generated and manually/visually verified for correctness.

The `generate-manifests.go` tool is used to generate the tests cases by calling convert.Convert on bundles
in the `testdata` directory.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ServiceAccount
metadata:
creationTimestamp: null
name: argocd-operator-controller-manager
namespace: argocd-system
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: argocd-operator.v0-1dhiybrldl1gyksid1dk2dqjsc72psdybc7iyvse5gpx
rules:
- apiGroups:
- ""
resources:
- configmaps
- endpoints
- events
- namespaces
- persistentvolumeclaims
- pods
- secrets
- serviceaccounts
- services
- services/finalizers
verbs:
- '*'
- apiGroups:
- ""
resources:
- pods
- pods/log
verbs:
- get
- apiGroups:
- apps
resources:
- daemonsets
- deployments
- replicasets
- statefulsets
verbs:
- '*'
- apiGroups:
- apps
resourceNames:
- argocd-operator
resources:
- deployments/finalizers
verbs:
- update
- apiGroups:
- apps.openshift.io
resources:
- deploymentconfigs
verbs:
- '*'
- apiGroups:
- argoproj.io
resources:
- applications
- appprojects
verbs:
- '*'
- apiGroups:
- argoproj.io
resources:
- argocdexports
- argocdexports/finalizers
- argocdexports/status
verbs:
- '*'
- apiGroups:
- argoproj.io
resources:
- argocds
- argocds/finalizers
- argocds/status
verbs:
- '*'
- apiGroups:
- autoscaling
resources:
- horizontalpodautoscalers
verbs:
- '*'
- apiGroups:
- batch
resources:
- cronjobs
- jobs
verbs:
- '*'
- apiGroups:
- config.openshift.io
resources:
- clusterversions
verbs:
- get
- list
- watch
- apiGroups:
- monitoring.coreos.com
resources:
- prometheuses
- servicemonitors
verbs:
- '*'
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- '*'
- apiGroups:
- oauth.openshift.io
resources:
- oauthclients
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- rbac.authorization.k8s.io
resources:
- '*'
verbs:
- '*'
- apiGroups:
- rbac.authorization.k8s.io
resources:
- clusterrolebindings
- clusterroles
verbs:
- '*'
- apiGroups:
- route.openshift.io
resources:
- routes
- routes/custom-host
verbs:
- '*'
- apiGroups:
- template.openshift.io
resources:
- templateconfigs
- templateinstances
- templates
verbs:
- '*'
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: argocd-operator.v0-22gmilmgp91wu25is5i2ec598hni8owq3l71bbkl7iz3
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
creationTimestamp: null
name: argocd-operator.v0-1dhiybrldl1gyksid1dk2dqjsc72psdybc7iyvse5gpx
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: argocd-operator.v0-1dhiybrldl1gyksid1dk2dqjsc72psdybc7iyvse5gpx
subjects:
- kind: ServiceAccount
name: argocd-operator-controller-manager
namespace: argocd-system
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
creationTimestamp: null
name: argocd-operator.v0-22gmilmgp91wu25is5i2ec598hni8owq3l71bbkl7iz3
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: argocd-operator.v0-22gmilmgp91wu25is5i2ec598hni8owq3l71bbkl7iz3
subjects:
- kind: ServiceAccount
name: argocd-operator-controller-manager
namespace: argocd-system
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
control-plane: controller-manager
name: argocd-operator-controller-manager-metrics-service
namespace: argocd-system
spec:
ports:
- name: https
port: 8443
targetPort: https
selector:
control-plane: controller-manager
status:
loadBalancer: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
data:
controller_manager_config.yaml: |
apiVersion: controller-runtime.sigs.k8s.io/v1alpha1
kind: ControllerManagerConfig
health:
healthProbeBindAddress: :8081
metrics:
bindAddress: 127.0.0.1:8080
webhook:
port: 9443
leaderElection:
leaderElect: true
resourceName: b674928d.argoproj.io
kind: ConfigMap
metadata:
name: argocd-operator-manager-config
namespace: argocd-system
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: argocd-operator-metrics-reader
rules:
- nonResourceURLs:
- /metrics
verbs:
- get
Loading