Skip to content

Commit

Permalink
Merge pull request #80 from dhellmann/unit-test
Browse files Browse the repository at this point in the history
make actuator tests more verbose for debugging
  • Loading branch information
openshift-merge-robot committed Jul 15, 2020
2 parents ab8b864 + 267edd4 commit 7fea25d
Show file tree
Hide file tree
Showing 16 changed files with 4,552 additions and 9 deletions.
1 change: 1 addition & 0 deletions go.mod
Expand Up @@ -6,6 +6,7 @@ require (
github.com/metal3-io/baremetal-operator v0.0.0
github.com/onsi/gomega v1.9.0
github.com/openshift/machine-api-operator v0.2.1-0.20200402110321-4f3602b96da3
github.com/stretchr/testify v1.4.0
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5
k8s.io/api v0.18.2
k8s.io/apiextensions-apiserver v0.18.2 // indirect
Expand Down
19 changes: 10 additions & 9 deletions pkg/cloud/baremetal/actuators/machine/actuator_test.go
Expand Up @@ -2,22 +2,25 @@ package machine

import (
"context"
"testing"
"time"

"reflect"

bmoapis "github.com/metal3-io/baremetal-operator/pkg/apis"
bmh "github.com/metal3-io/baremetal-operator/pkg/apis/metal3/v1alpha1"
bmv1alpha1 "github.com/openshift/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1"
machinev1beta1 "github.com/openshift/machine-api-operator/pkg/apis/machine/v1beta1"
machineapierrors "github.com/openshift/machine-api-operator/pkg/controller/machine"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"reflect"
"sigs.k8s.io/controller-runtime/pkg/client"
fakeclient "sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/yaml"
"testing"
"time"
)

const (
Expand Down Expand Up @@ -1943,13 +1946,11 @@ func TestRemediation(t *testing.T) {
node = &corev1.Node{}
c.Get(context.TODO(), nodeNamespacedName, node)

if !reflect.DeepEqual(node.Annotations, nodeAnnotations) {
t.Errorf("Node annotations before remediation and after remediation ares not equal")
}
assert.Equal(t, nodeAnnotations, node.Annotations,
"Node annotations before remediation and after remediation ares not equal")

if !reflect.DeepEqual(node.Labels, nodeLabels) {
t.Errorf("Node labels before remediation and after remediation ares not equal")
}
assert.Equal(t, nodeLabels, node.Labels,
"Node labels before remediation and after remediation ares not equal")

machine = &machinev1beta1.Machine{}
c.Get(context.TODO(), machineNamespacedName, machine)
Expand Down
27 changes: 27 additions & 0 deletions vendor/github.com/pmezard/go-difflib/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7fea25d

Please sign in to comment.