Skip to content

Commit

Permalink
Fix ginkgo bootstrap script
Browse files Browse the repository at this point in the history
We no longer have the ginkgo cli since kubevirt@9d9b35e
so this script silently fails.

Signed-off-by: Alex Kalenyuk <[email protected]>
  • Loading branch information
akalenyu committed Oct 31, 2023
1 parent d7a1e43 commit 5c8f54c
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 4 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ gen-proto:
hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} IMAGE_PULL_POLICY=${IMAGE_PULL_POLICY} VERBOSITY=${VERBOSITY} ./hack/gen-proto.sh"

generate:
hack/dockerized hack/build-ginkgo.sh
hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} IMAGE_PULL_POLICY=${IMAGE_PULL_POLICY} VERBOSITY=${VERBOSITY} ./hack/generate.sh"
SYNC_VENDOR=true hack/dockerized "./hack/bazel-generate.sh && hack/bazel-fmt.sh"
hack/dockerized hack/sync-kubevirtci.sh
Expand Down
1 change: 1 addition & 0 deletions hack/bootstrap-ginkgo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -e

source $(dirname "$0")/common.sh

_out/tests/ginkgo version
# Find every folder containing tests
for dir in $(find ${KUBEVIRT_DIR}/pkg/ -type f -name '*_test.go' -printf '%h\n' | sort -u); do
# If there is no file ending with _suite_test.go, bootstrap ginkgo
Expand Down
18 changes: 18 additions & 0 deletions hack/build-ginkgo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

set -ex

source hack/common.sh
source hack/bootstrap.sh
source hack/config.sh

rm -rf "${TESTS_OUT_DIR}"
mkdir -p "${TESTS_OUT_DIR}/tools"

bazel build \
--config=${HOST_ARCHITECTURE} \
//vendor/github.com/onsi/ginkgo/v2/ginkgo:ginkgo

bazel run \
--config=${HOST_ARCHITECTURE} \
:build-ginkgo -- ${TESTS_OUT_DIR}/ginkgo
7 changes: 6 additions & 1 deletion pkg/virt-api/webhooks/fuzz/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ load("@io_bazel_rules_go//go:def.bzl", "go_test")

go_test(
name = "go_default_test",
srcs = ["fuzz_test.go"],
srcs = [
"fuzz_suite_test.go",
"fuzz_test.go",
],
tags = ["fuzz"],
deps = [
"//pkg/testutils:go_default_library",
Expand All @@ -11,6 +14,8 @@ go_test(
"//pkg/virt-config:go_default_library",
"//staging/src/kubevirt.io/api/core/v1:go_default_library",
"//vendor/github.com/google/gofuzz:go_default_library",
"//vendor/github.com/onsi/ginkgo/v2:go_default_library",
"//vendor/github.com/onsi/gomega:go_default_library",
"//vendor/k8s.io/api/admission/v1:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
Expand Down
13 changes: 13 additions & 0 deletions pkg/virt-api/webhooks/fuzz/fuzz_suite_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package fuzz_test

import (
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

func TestFuzz(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Fuzz Suite")
}
5 changes: 4 additions & 1 deletion pkg/virtctl/credentials/add-key/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ go_library(

go_test(
name = "go_default_test",
srcs = ["add-key_test.go"],
srcs = [
"add-key_test.go",
"add_key_suite_test.go",
],
deps = [
"//staging/src/kubevirt.io/api/core:go_default_library",
"//staging/src/kubevirt.io/api/core/v1:go_default_library",
Expand Down
13 changes: 13 additions & 0 deletions pkg/virtctl/credentials/add-key/add_key_suite_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package add_key_test

import (
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

func TestAddKey(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "AddKey Suite")
}
5 changes: 4 additions & 1 deletion pkg/virtctl/credentials/remove-key/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ go_library(

go_test(
name = "go_default_test",
srcs = ["remove-key_test.go"],
srcs = [
"remove-key_test.go",
"remove_key_suite_test.go",
],
deps = [
"//staging/src/kubevirt.io/api/core:go_default_library",
"//staging/src/kubevirt.io/api/core/v1:go_default_library",
Expand Down
13 changes: 13 additions & 0 deletions pkg/virtctl/credentials/remove-key/remove_key_suite_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package remove_key_test

import (
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

func TestRemoveKey(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "RemoveKey Suite")
}
5 changes: 4 additions & 1 deletion pkg/virtctl/credentials/set-password/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ go_library(

go_test(
name = "go_default_test",
srcs = ["set-password_test.go"],
srcs = [
"set-password_test.go",
"set_password_suite_test.go",
],
deps = [
"//staging/src/kubevirt.io/api/core:go_default_library",
"//staging/src/kubevirt.io/api/core/v1:go_default_library",
Expand Down
13 changes: 13 additions & 0 deletions pkg/virtctl/credentials/set-password/set_password_suite_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package set_password_test

import (
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

func TestSetPassword(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "SetPassword Suite")
}

0 comments on commit 5c8f54c

Please sign in to comment.