Skip to content

Commit

Permalink
build: fix the build action
Browse files Browse the repository at this point in the history
  • Loading branch information
clementnuss committed Nov 23, 2021
1 parent ea54f5e commit 5a55337
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Build
name: Build and test

on:
push:
branches: ['*']
push:
branches: ["*"]
pull_request:

jobs:

build:
name: Build
runs-on: ubuntu-latest
Expand All @@ -18,4 +18,13 @@ jobs:

- run: |
go build ./...
go test -run=^$ ./...
- run: |
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
mkdir -p local/envtest-bin/
setup-envtest use -p env 1.21.x --bin-dir local/envtest-bin > local/envtest-bin/env
- run: |
source local/envtest-bin/env
export KUBEBUILDER_ASSETS=$(pwd)/$KUBEBUILDER_ASSETS
go test -run=^$ ./...
12 changes: 6 additions & 6 deletions controller/csr_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestValidCsrApproved(t *testing.T) {
validCsr := createCsr(t, csrParams)

_, nodeClientSet, _ := createControlPlaneUser(t, validCsr.Spec.Username, []string{"system:masters"})
_, err = nodeClientSet.CertificatesV1().CertificateSigningRequests().Create(testContext, &validCsr, metav1.CreateOptions{})
_, err := nodeClientSet.CertificatesV1().CertificateSigningRequests().Create(testContext, &validCsr, metav1.CreateOptions{})
require.Nil(t, err, "Could not create the CSR.")

approved, denied, err := waitCsrApprovalStatus(validCsr.Name)
Expand All @@ -53,7 +53,7 @@ func TestWrongSignerCsr(t *testing.T) {
csr.Spec.SignerName = "example.com/not-kubelet-serving"

_, nodeClientSet, _ := createControlPlaneUser(t, csr.Spec.Username, []string{"system:masters"})
_, err = nodeClientSet.CertificatesV1().CertificateSigningRequests().Create(testContext, &csr, metav1.CreateOptions{})
_, err := nodeClientSet.CertificatesV1().CertificateSigningRequests().Create(testContext, &csr, metav1.CreateOptions{})
require.Nil(t, err, "Could not create the CSR.")

approved, denied, err := waitCsrApprovalStatus(csr.Name)
Expand All @@ -71,7 +71,7 @@ func TestNonMatchingCommonNameUsername(t *testing.T) {
csr := createCsr(t, csrParams)
_, nodeClientSet, _ := createControlPlaneUser(t, csr.Spec.Username, []string{"system:masters"})

_, err = nodeClientSet.CertificatesV1().CertificateSigningRequests().Create(testContext, &csr, metav1.CreateOptions{})
_, err := nodeClientSet.CertificatesV1().CertificateSigningRequests().Create(testContext, &csr, metav1.CreateOptions{})
require.Nil(t, err, "Could not create the CSR.")

approved, denied, err := waitCsrApprovalStatus(csr.Name)
Expand All @@ -92,7 +92,7 @@ func TestInvalidDNSName(t *testing.T) {
csr := createCsr(t, csrParams)
_, nodeClientSet, _ := createControlPlaneUser(t, csr.Spec.Username, []string{"system:masters"})

_, err = nodeClientSet.CertificatesV1().CertificateSigningRequests().Create(testContext, &csr, metav1.CreateOptions{})
_, err := nodeClientSet.CertificatesV1().CertificateSigningRequests().Create(testContext, &csr, metav1.CreateOptions{})
require.Nil(t, err, "Could not create the CSR.")

approved, denied, err := waitCsrApprovalStatus(csr.Name)
Expand All @@ -110,7 +110,7 @@ func TestUnresolvedDNSName(t *testing.T) {
csr := createCsr(t, csrParams)
_, nodeClientSet, _ := createControlPlaneUser(t, csr.Spec.Username, []string{"system:masters"})

_, err = nodeClientSet.CertificatesV1().CertificateSigningRequests().Create(testContext, &csr, metav1.CreateOptions{})
_, err := nodeClientSet.CertificatesV1().CertificateSigningRequests().Create(testContext, &csr, metav1.CreateOptions{})
require.Nil(t, err, "Could not create the CSR.")

approved, denied, err := waitCsrApprovalStatus(csr.Name)
Expand All @@ -128,7 +128,7 @@ func TestMismatchedResolvedIpsSANIps(t *testing.T) {
csr := createCsr(t, csrParams)
_, nodeClientSet, _ := createControlPlaneUser(t, csr.Spec.Username, []string{"system:masters"})

_, err = nodeClientSet.CertificatesV1().CertificateSigningRequests().Create(testContext, &csr, metav1.CreateOptions{})
_, err := nodeClientSet.CertificatesV1().CertificateSigningRequests().Create(testContext, &csr, metav1.CreateOptions{})
require.Nil(t, err, "Could not create the CSR.")

approved, denied, err := waitCsrApprovalStatus(csr.Name)
Expand Down

0 comments on commit 5a55337

Please sign in to comment.