From 1cc2f821f513e090d67150727d34d4468892b9eb Mon Sep 17 00:00:00 2001 From: Cezar Craciunoiu Date: Fri, 26 Jul 2024 14:52:30 +0300 Subject: [PATCH 1/2] fix(test): Adapt tests to latest version Signed-off-by: Cezar Craciunoiu --- test/e2e/cloud/instance_create_test.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/test/e2e/cloud/instance_create_test.go b/test/e2e/cloud/instance_create_test.go index 2244022cc..ab757c77e 100644 --- a/test/e2e/cloud/instance_create_test.go +++ b/test/e2e/cloud/instance_create_test.go @@ -35,8 +35,8 @@ func urlParser(stdout *fcmd.IOStream) string { } func serviceParser(stdout *fcmd.IOStream) string { - if strings.Contains(stdout.String(), "service_group\":") { - services := strings.SplitN(stdout.String(), "service_group\":\"", 2)[1] + if strings.Contains(stdout.String(), "service\":") { + services := strings.SplitN(stdout.String(), "service\":\"", 2)[1] services = strings.SplitN(services, "\"", 2)[0] return services } @@ -209,7 +209,7 @@ var _ = Describe("kraft cloud instance create", func() { Expect(err).ToNot(HaveOccurred()) Expect(stderr.String()).To(BeEmpty()) - Expect(stdout.String()).To(MatchRegexp(`Create an instance on KraftCloud from an image.\n`)) + Expect(stdout.String()).To(MatchRegexp(`Create an instance on Unikraft Cloud from an image.\n`)) }) }) @@ -388,7 +388,7 @@ var _ = Describe("kraft cloud instance create", func() { Expect(err).To(HaveOccurred()) Expect(stdout.String()).ToNot(BeEmpty()) - Expect(stdout.String()).To(MatchRegexp(`flag: strconv.ParseUint: parsing`)) + Expect(stdout.String()).To(MatchRegexp(`memory must be at least 1Mi`)) }) }) @@ -446,7 +446,7 @@ var _ = Describe("kraft cloud instance create", func() { Expect(err).To(HaveOccurred()) Expect(stdout.String()).ToNot(BeEmpty()) - Expect(stdout.String()).To(MatchRegexp(`strconv\.ParseUint: parsing \\"16\.56\\": invalid syntax`)) + Expect(stdout.String()).To(MatchRegexp(`memory must be at least 1Mi`)) }) }) @@ -475,7 +475,7 @@ var _ = Describe("kraft cloud instance create", func() { Expect(err).To(HaveOccurred()) Expect(stdout.String()).ToNot(BeEmpty()) - Expect(stdout.String()).To(MatchRegexp(`strconv.ParseUint: parsing \\"seventeen\\": invalid syntax`)) + Expect(stdout.String()).To(MatchRegexp(`could not parse memory quantity: quantities must match the regular expression`)) }) }) @@ -756,14 +756,13 @@ var _ = Describe("kraft cloud instance create", func() { ) }) - It("should error out with an API error", func() { + It("should not error out with an API error", func() { err := cmd.Run() time.Sleep(2 * time.Second) - Expect(err).To(HaveOccurred()) + Expect(err).ToNot(HaveOccurred()) Expect(stderr.String()).To(BeEmpty()) Expect(stdout.String()).ToNot(BeEmpty()) - Expect(stdout.String()).To(MatchRegexp(`Invalid name`)) }) }) @@ -1684,7 +1683,7 @@ var _ = Describe("kraft cloud instance create", func() { "--port", instancePortMap, "--memory", instanceMemory, "--name", instanceNameFull, - "--domain", "smth-"+instanceNameFull, + "--domain", "smth-"+instanceNameFull+".xyz", "--start", imageName, ) @@ -1873,7 +1872,7 @@ var _ = Describe("kraft cloud instance create", func() { cmd.Args = append(cmd.Args, "--port", instancePortMap, "--name", instanceNameFull, - "--scale-to-zero", + "--scale-to-zero", "on", imageName, ) }) @@ -2418,7 +2417,7 @@ var _ = Describe("kraft cloud instance create", func() { Expect(stderr.String()).To(BeEmpty()) Expect(stdout.String()).ToNot(BeEmpty()) - Expect(stdout.String()).To(MatchRegexp(`No service with name 'smth`)) + Expect(stdout.String()).To(MatchRegexp(`No service group with name 'smth`)) }) }) From dae12506f77b81888261e83e46422d6683d13982 Mon Sep 17 00:00:00 2001 From: Cezar Craciunoiu Date: Fri, 26 Jul 2024 14:54:43 +0300 Subject: [PATCH 2/2] fix(workflows): Start buildkit for mac tests Signed-off-by: Cezar Craciunoiu --- .github/workflows/tests-stable.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/tests-stable.yaml b/.github/workflows/tests-stable.yaml index 2666a37f3..1c818c783 100644 --- a/.github/workflows/tests-stable.yaml +++ b/.github/workflows/tests-stable.yaml @@ -12,6 +12,26 @@ jobs: os: [ubuntu-24.04, ubuntu-22.04, macos-12, macos-13, macos-14, mac-m2-14] runs-on: ${{ matrix.os }} steps: + - name: Generate Suffix + shell: bash + id: suffix + run: echo "suffix=$(date +%s)" >> "$GITHUB_OUTPUT" + + - name: Set up BuildKit + shell: bash + run: | + docker run \ + --rm \ + -itd \ + --privileged \ + --name "buildkitd_${GITHUB_RUN_ID}_${SUFFIX}" \ + -v /run/buildkit:/run/buildkit:rw \ + moby/buildkit:v0.14.1; + timeout 60 bash -c 'while [ ! -S "/run/buildkit/buildkitd.sock" ]; do sleep 1; done' + sudo chmod 666 /run/buildkit/buildkitd.sock; + env: + SUFFIX: ${{ steps.suffix.outputs.suffix }} + - uses: actions/checkout@v4 with: submodules: recursive @@ -43,6 +63,11 @@ jobs: - name: Run tests run: make test-unit + - name: Stop BuildKit + if: always() + shell: bash + run: docker stop "buildkitd_${GITHUB_RUN_ID}_${{ steps.suffix.outputs.suffix }}" || true + e2e-cli: strategy: fail-fast: false