Skip to content

Commit

Permalink
Upgrade ginkgo to v2
Browse files Browse the repository at this point in the history
Signed-off-by: Eddie Torres <torredil@amazon.com>
  • Loading branch information
torredil committed Oct 6, 2022
1 parent e7d9548 commit a4ae7df
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 39 deletions.
6 changes: 5 additions & 1 deletion tests/e2e/dynamic_provisioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"os"
"strings"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
v1 "k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
clientset "k8s.io/client-go/kubernetes"
Expand All @@ -35,10 +35,12 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer"
admissionapi "k8s.io/pod-security-admission/api"
)

var _ = Describe("[ebs-csi-e2e] [single-az] Dynamic Provisioning", func() {
f := framework.NewDefaultFramework("ebs")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged

var (
cs clientset.Interface
Expand Down Expand Up @@ -432,6 +434,7 @@ var _ = Describe("[ebs-csi-e2e] [single-az] Dynamic Provisioning", func() {

var _ = Describe("[ebs-csi-e2e] [single-az] Snapshot", func() {
f := framework.NewDefaultFramework("ebs")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged

var (
cs clientset.Interface
Expand Down Expand Up @@ -492,6 +495,7 @@ var _ = Describe("[ebs-csi-e2e] [single-az] Snapshot", func() {

var _ = Describe("[ebs-csi-e2e] [multi-az] Dynamic Provisioning", func() {
f := framework.NewDefaultFramework("ebs")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged

var (
cs clientset.Interface
Expand Down
4 changes: 3 additions & 1 deletion tests/e2e/pre_provsioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ import (
awscloud "github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud"
"github.com/kubernetes-sigs/aws-ebs-csi-driver/tests/e2e/driver"
"github.com/kubernetes-sigs/aws-ebs-csi-driver/tests/e2e/testsuites"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
v1 "k8s.io/api/core/v1"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"
admissionapi "k8s.io/pod-security-admission/api"
)

const (
Expand All @@ -51,6 +52,7 @@ var (
// Requires env AWS_AVAILABILITY_ZONES a comma separated list of AZs to be set
var _ = Describe("[ebs-csi-e2e] [single-az] Pre-Provisioned", func() {
f := framework.NewDefaultFramework("ebs")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged

var (
cs clientset.Interface
Expand Down
15 changes: 4 additions & 11 deletions tests/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,16 @@ package e2e

import (
"flag"
"fmt"
"log"
"math/rand"
"os"
"path"
"path/filepath"
"testing"
"time"

"github.com/onsi/ginkgo/config"
"github.com/onsi/ginkgo/reporters"

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

"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/kubernetes/test/e2e/framework"
frameworkconfig "k8s.io/kubernetes/test/e2e/framework/config"
)
Expand Down Expand Up @@ -61,13 +55,12 @@ func TestE2E(t *testing.T) {
// Run tests through the Ginkgo runner with output to console + JUnit for Jenkins
var r []Reporter
if framework.TestContext.ReportDir != "" {
// Create the directory if it doesn't already exists
// NOTE: junit report can be created with new --junit-report flag
// https://github.com/kubernetes/kubernetes/blob/4569e646ef161c0262d433aed324fec97a525572/test/e2e_kubeadm/e2e_kubeadm_suite_test.go
if err := os.MkdirAll(framework.TestContext.ReportDir, 0755); err != nil {
log.Fatalf("Failed creating report directory: %v", err)
} else {
r = append(r, reporters.NewJUnitReporter(path.Join(framework.TestContext.ReportDir, fmt.Sprintf("junit_%v%02d.xml", framework.TestContext.ReportPrefix, config.GinkgoConfig.ParallelNode))))
}
}
log.Printf("Starting e2e run %q on Ginkgo node %d", uuid.NewUUID(), config.GinkgoConfig.ParallelNode) // TODO use framework.RunID like upstream

RunSpecsWithDefaultAndCustomReporters(t, "AWS EBS CSI Driver End-to-End Tests", r)
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ package testsuites

import (
"github.com/kubernetes-sigs/aws-ebs-csi-driver/tests/e2e/driver"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
clientset "k8s.io/client-go/kubernetes"

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

// DynamicallyProvisionedCmdVolumeTest will provision required StorageClass(es), PVC(s) and Pod(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ package testsuites
import (
"github.com/kubernetes-sigs/aws-ebs-csi-driver/tests/e2e/driver"

"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
clientset "k8s.io/client-go/kubernetes"

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

// DynamicallyProvisionedCollocatedPodTest will provision required StorageClass(es), PVC(s) and Pod(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ package testsuites

import (
"github.com/kubernetes-sigs/aws-ebs-csi-driver/tests/e2e/driver"
. "github.com/onsi/ginkgo"
"k8s.io/api/core/v1"
. "github.com/onsi/ginkgo/v2"
v1 "k8s.io/api/core/v1"
clientset "k8s.io/client-go/kubernetes"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ package testsuites

import (
"fmt"

"github.com/kubernetes-sigs/aws-ebs-csi-driver/tests/e2e/driver"
v1 "k8s.io/api/core/v1"
"k8s.io/kubernetes/test/e2e/framework"

"k8s.io/api/core/v1"
clientset "k8s.io/client-go/kubernetes"

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ package testsuites
import (
"context"
"fmt"
"time"

"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/util"
"github.com/kubernetes-sigs/aws-ebs-csi-driver/tests/e2e/driver"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/test/e2e/framework"
"time"

. "github.com/onsi/ginkgo"
"k8s.io/api/core/v1"
. "github.com/onsi/ginkgo/v2"
clientset "k8s.io/client-go/kubernetes"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ package testsuites

import (
"fmt"

"github.com/kubernetes-sigs/aws-ebs-csi-driver/tests/e2e/driver"

"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
clientset "k8s.io/client-go/kubernetes"

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

// DynamicallyProvisionedTopologyAwareVolumeTest will provision required StorageClass(es), PVC(s) and Pod(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ package testsuites
import (
"github.com/kubernetes-sigs/aws-ebs-csi-driver/tests/e2e/driver"

"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
clientset "k8s.io/client-go/kubernetes"
restclientset "k8s.io/client-go/rest"

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

// DynamicallyProvisionedVolumeSnapshotTest will provision required StorageClass(es),VolumeSnapshotClass(es), PVC(s) and Pod(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ package testsuites

import (
"fmt"

"github.com/kubernetes-sigs/aws-ebs-csi-driver/tests/e2e/driver"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package testsuites

import (
"fmt"

"github.com/kubernetes-sigs/aws-ebs-csi-driver/tests/e2e/driver"
v1 "k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
Expand All @@ -25,7 +26,7 @@ import (

awscloud "github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud"

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

type PreProvisionedVolumeSnapshotTest struct {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/testsuites/pre_provisioned_volume_tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ package testsuites

import (
"github.com/kubernetes-sigs/aws-ebs-csi-driver/tests/e2e/driver"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
clientset "k8s.io/client-go/kubernetes"

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

// PreProvisionedVolumeTest will provision required PV(s), PVC(s) and Pod(s)
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/testsuites/specs.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import (

"github.com/kubernetes-sigs/aws-ebs-csi-driver/tests/e2e/driver"

"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
clientset "k8s.io/client-go/kubernetes"
restclientset "k8s.io/client-go/rest"

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

type PodDetails struct {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/testsuites/testsuites.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"
snapshotclientset "github.com/kubernetes-csi/external-snapshotter/client/v4/clientset/versioned"
awscloud "github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
apps "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -574,7 +574,7 @@ func (t *TestDeployment) DeletePodAndWait() {
return
}
e2elog.Logf("Waiting for pod %q in namespace %q to be fully deleted", t.podName, t.namespace.Name)
err = e2epod.WaitForPodNoLongerRunningInNamespace(t.client, t.podName, t.namespace.Name)
err = e2epod.WaitForPodNotFoundInNamespace(t.client, t.podName, t.namespace.Name, 3*time.Minute)
if err != nil {
if !apierrs.IsNotFound(err) {
framework.ExpectNoError(fmt.Errorf("pod %q error waiting for delete: %v", t.podName, err))
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/ec2"
csi "github.com/container-storage-interface/spec/lib/go/csi"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/util/wait"
)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud"
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver"
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/util"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"google.golang.org/grpc"
"k8s.io/client-go/kubernetes"
Expand Down

0 comments on commit a4ae7df

Please sign in to comment.