Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update e2e test to run against machine.openshift.io #151

Merged
Merged
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
10 changes: 5 additions & 5 deletions test/e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"flag"

"github.com/golang/glog"
capiv1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1"
mapiv1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1"
"k8s.io/client-go/kubernetes/scheme"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"
Expand All @@ -15,7 +15,7 @@ const (
)

func init() {
if err := capiv1alpha1.AddToScheme(scheme.Scheme); err != nil {
if err := mapiv1beta1.AddToScheme(scheme.Scheme); err != nil {
glog.Fatal(err)
}
}
Expand Down Expand Up @@ -58,9 +58,9 @@ func runSuite() error {
}
glog.Info("PASS: ExpectProviderAvailable")

glog.Info("RUN: ExpectOneClusterObject")
if err := testConfig.ExpectOneClusterObject(); err != nil {
glog.Errorf("FAIL: ExpectOneClusterObject: %v", err)
glog.Info("RUN: ExpectNoClusterObject")
if err := testConfig.ExpectNoClusterObject(); err != nil {
glog.Errorf("FAIL: ExpectNoClusterObject: %v", err)
return err
}
glog.Info("PASS: ExpectOneClusterObject")
Expand Down
22 changes: 11 additions & 11 deletions test/e2e/provider_expectations.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"

"github.com/golang/glog"
capiv1beta1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1"
mapiv1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1"
kappsapi "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -40,31 +40,31 @@ func (tc *testConfig) ExpectProviderAvailable() error {
return err
}

func (tc *testConfig) ExpectOneClusterObject() error {
func (tc *testConfig) ExpectNoClusterObject() error {
listOptions := client.ListOptions{
Namespace: namespace,
}
clusterList := capiv1beta1.ClusterList{}
clusterList := mapiv1beta1.ClusterList{}

err := wait.PollImmediate(1*time.Second, waitShort, func() (bool, error) {
if err := tc.client.List(context.TODO(), &listOptions, &clusterList); err != nil {
glog.Errorf("error querying api for clusterList object: %v, retrying...", err)
return false, nil
}
if len(clusterList.Items) != 1 {
return false, errors.New("more than one cluster object found")
if len(clusterList.Items) > 0 {
return false, errors.New("a cluster object was found")
}
return true, nil
})
return err
}

func (tc *testConfig) ExpectAllMachinesLinkedToANode() error {
machineAnnotationKey := "cluster.k8s.io/machine"
machineAnnotationKey := "machine.openshift.io/machine"
listOptions := client.ListOptions{
Namespace: namespace,
}
machineList := capiv1beta1.MachineList{}
machineList := mapiv1beta1.MachineList{}
nodeList := corev1.NodeList{}

err := wait.PollImmediate(1*time.Second, waitShort, func() (bool, error) {
Expand Down Expand Up @@ -107,7 +107,7 @@ func (tc *testConfig) ExpectNewNodeWhenDeletingMachine() error {
listOptions := client.ListOptions{
Namespace: namespace,
}
machineList := capiv1beta1.MachineList{}
machineList := mapiv1beta1.MachineList{}
nodeList := corev1.NodeList{}

glog.Info("Get machineList")
Expand Down Expand Up @@ -136,7 +136,7 @@ func (tc *testConfig) ExpectNewNodeWhenDeletingMachine() error {

clusterInitialTotalNodes := len(nodeList.Items)
clusterInitialTotalMachines := len(machineList.Items)
var triagedWorkerMachine capiv1beta1.Machine
var triagedWorkerMachine mapiv1beta1.Machine
var triagedWorkerNode corev1.Node
MachineLoop:
for _, m := range machineList.Items {
Expand Down Expand Up @@ -204,13 +204,13 @@ func (tc *testConfig) ExpectNodeToBeDrainedBeforeDeletingMachine() error {
Namespace: namespace,
}

var machine capiv1beta1.Machine
var machine mapiv1beta1.Machine
var nodeName string
var node *corev1.Node

glog.Info("Get machineList with at least one machine with NodeRef set")
if err := wait.PollImmediate(1*time.Second, waitShort, func() (bool, error) {
machineList := capiv1beta1.MachineList{}
machineList := mapiv1beta1.MachineList{}
if err := tc.client.List(context.TODO(), &listOptions, &machineList); err != nil {
glog.Errorf("error querying api for machineList object: %v, retrying...", err)
return false, nil
Expand Down