Skip to content
Draft
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
50 changes: 47 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,71 @@ jobs:

- name: Install Ginkgo
run: go install github.com/onsi/ginkgo/v2/ginkgo


- name: Install helm
uses: azure/setup-helm@v4.3.0

- name: Install k3d and kubectl
run: |
wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
k3d version

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

- name: Setup Kubernetes (k3d)
env:
REPO_NAME: k3k-registry
REPO_PORT: 12345
run: |
echo "127.0.0.1 ${REPO_NAME}" | sudo tee -a /etc/hosts

k3d registry create ${REPO_NAME} --port ${REPO_PORT}

k3d cluster create k3k --servers 3 \
-p "30000-30010:30000-30010@server:0" \
--registry-use k3d-${REPO_NAME}:${REPO_PORT}

kubectl cluster-info
kubectl get nodes

- name: Set coverage environment
run: |
mkdir ${{ github.workspace }}/covdata

echo "COVERAGE=true" >> $GITHUB_ENV
echo "GOCOVERDIR=${{ github.workspace }}/covdata" >> $GITHUB_ENV

- name: Build and package
- name: Setup K3k
env:
REPO: k3k-registry:12345
run: |
echo "127.0.0.1 k3k-registry" | sudo tee -a /etc/hosts

make build
make package
make push

# add k3kcli to $PATH
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH

VERSION=$(make version)
k3d image import ${REPO}/k3k:${VERSION} -c k3k --verbose
k3d image import ${REPO}/k3k-kubelet:${VERSION} -c k3k --verbose

make install

echo "Wait for K3k controller to be available"
kubectl wait -n k3k-system pod --for condition=Ready -l "app.kubernetes.io/name=k3k" --timeout=5m

- name: Check k3kcli
run: k3kcli -v

- name: Run e2e tests
run: make test-e2e
run: |
export REPO=k3k-registry:12345
export VERSION=$(make version)

make test-e2e

- name: Convert coverage data
run: go tool covdata textfmt -i=${GOCOVERDIR} -o ${GOCOVERDIR}/cover.out
Expand Down
12 changes: 11 additions & 1 deletion tests/tests_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,17 @@ func installK3kChart(ctx context.Context, kubeconfig []byte) {
"tag": "dev",
})

err = k3sContainer.LoadImages(ctx, "rancher/k3k:dev", "rancher/k3k-kubelet:dev")
repo := "rancher"
if repoEnv := os.Getenv("REPO"); repoEnv != "" {
repo = repoEnv
}

version := "dev"
if versionEnv := os.Getenv("VERSION"); versionEnv != "" {
version = versionEnv
}

err = k3sContainer.LoadImages(ctx, repo+"/k3k:"+version, repo+"/k3k-kubelet:"+version)
Expect(err).To(Not(HaveOccurred()))

release, err := iCli.Run(k3kChart, k3kChart.Values)
Expand Down
Loading