Skip to content

Commit

Permalink
feat(main): add test webhooks
Browse files Browse the repository at this point in the history
Signed-off-by: cuisongliu <[email protected]>
  • Loading branch information
cuisongliu committed Oct 18, 2024
1 parent b65beac commit fd7e29d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 126 deletions.
44 changes: 23 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
job1:
job2:
runs-on: ubuntu-20.04
steps:
- name: Checkout
Expand All @@ -42,26 +42,13 @@ jobs:
- name: Verify sealos
run: |
curl -sfL https://raw.githubusercontent.com/labring/sealos/v5.0.0/scripts/install.sh | sh -s v5.0.0 labring/sealos
- name: prune os
run: |
sudo systemctl unmask containerd
sudo systemctl unmask docker
sudo apt-get remove -y moby-buildx moby-cli moby-compose moby-containerd moby-engine
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get purge docker-ce docker-ce-cli containerd.io # docker-compose-plugin
sudo apt-get remove -y moby-engine moby-cli moby-buildx moby-compose
sudo rm -rf /var/run/docker.sock
sudo rm -rf /run/containerd/containerd.sock
sudo sealos run labring/kubernetes:v1.25.0 labring/helm:v3.8.2 labring/calico:v3.26.5 labring/openebs:v3.9.0
- name: build
run: |
sudo make e2e
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
go run gen/version/gen.go ghcr.io/${{ github.repository_owner }}/automq-operator:latest && make info
cd deploy
sudo sealos build -t ghcr.io/${{ github.repository_owner }}/automq-operator-sealos:latest .
job2:
job1:
runs-on: ubuntu-20.04
steps:
- name: Checkout
Expand All @@ -75,8 +62,23 @@ jobs:
- name: Verify sealos
run: |
curl -sfL https://raw.githubusercontent.com/labring/sealos/v5.0.0/scripts/install.sh | sh -s v5.0.0 labring/sealos
- name: prune os
run: |
sudo systemctl unmask containerd
sudo systemctl unmask docker
sudo apt-get remove -y moby-buildx moby-cli moby-compose moby-containerd moby-engine
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get purge docker-ce docker-ce-cli containerd.io # docker-compose-plugin
sudo apt-get remove -y moby-engine moby-cli moby-buildx moby-compose
sudo rm -rf /var/run/docker.sock
sudo rm -rf /run/containerd/containerd.sock
sudo sealos run labring/kubernetes:v1.27.7
sudo sealos run labring/helm:v3.9.4 labring/calico:v3.26.5 labring/openebs:v3.9.0 labring/cert-manager:v1.14.6
sudo sealos run labring/minio:RELEASE.2024-01-11T07-46-16Z labring/kube-prometheus-stack:v0.63.0 labring/kafka-ui:v0.7.1
- name: build
run: |
go run gen/version/gen.go ghcr.io/${{ github.repository_owner }}/automq-operator:latest && make info
cd deploy
sudo sealos build -t ghcr.io/${{ github.repository_owner }}/automq-operator-sealos:latest .
sudo make e2e
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
10 changes: 10 additions & 0 deletions api/v1beta1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@ var _ = Describe("Update", func() {
Expect(err.Error()).To(ContainSubstring("clusterID"))
Expect(err.Error()).To(ContainSubstring("immutable"))
})
It("Update Controller Replicas", func() {
aq := initAutoMQ()
err := k8sClient.Create(context.Background(), aq)
Expect(err).To(BeNil())
aq.Spec.Controller.Replicas = 2
err = k8sClient.Update(context.Background(), aq)
Expect(true).To(Equal(errors.IsForbidden(err)))
Expect(err.Error()).To(ContainSubstring("controller.replicas"))
Expect(err.Error()).To(ContainSubstring("immutable"))
})
})

})
Expand Down
105 changes: 0 additions & 105 deletions e2e/utils.go

This file was deleted.

0 comments on commit fd7e29d

Please sign in to comment.