Commit fb88f4b 1 parent e12b3d6 commit fb88f4b Copy full SHA for fb88f4b
File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 1
1
package servicehandler
2
2
3
3
import (
4
+ "reflect"
4
5
"testing"
5
6
6
7
v1 "k8s.io/api/core/v1"
8
+ "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
7
9
)
8
10
9
11
var TestAuthentications = ServiceAuthentication {
@@ -43,12 +45,16 @@ var TestAuthentications = ServiceAuthentication{
43
45
}
44
46
45
47
func TestUnstructured (t * testing.T ) {
46
- obj , err := TestAuthentications .Unstructured ()
47
- if err = = nil {
48
+ unstructuredObject , err := TestAuthentications .Unstructured ()
49
+ if err ! = nil {
48
50
t .Errorf ("Unstructured() got an error: %v" , err )
49
51
}
50
- if obj == nil {
51
- t .Errorf ("Unstructured() returned nil" )
52
+ objType := reflect .TypeOf (unstructuredObject )
53
+ if unstructuredType := reflect .TypeOf (& unstructured.Unstructured {}); objType != unstructuredType {
54
+ t .Errorf ("Unstructured() returned an object of unexpected type" )
55
+ }
56
+ if unstructuredObject .Object == nil {
57
+ t .Errorf ("Unstructured() returned an object with nil value" )
52
58
}
53
59
}
54
60
You can’t perform that action at this time.
0 commit comments