Skip to content

Commit c133dba

Browse files
committed
addressing feedback
1 parent 88d1ceb commit c133dba

File tree

4 files changed

+9
-45
lines changed

4 files changed

+9
-45
lines changed

test/e2e/instascale.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ func JobAppwrapperSetup(test Test, namespace *corev1.Namespace, config *corev1.C
8585
MountPath: "/test",
8686
},
8787
{
88-
Name: "test2",
89-
MountPath: "/test2",
88+
Name: "workdir",
89+
MountPath: "/workdir",
9090
},
9191
},
92-
WorkingDir: "/test2",
92+
WorkingDir: "workdir",
9393
},
9494
},
9595
Volumes: []corev1.Volume{
@@ -104,7 +104,7 @@ func JobAppwrapperSetup(test Test, namespace *corev1.Namespace, config *corev1.C
104104
},
105105
},
106106
{
107-
Name: "test2",
107+
Name: "workdir",
108108
VolumeSource: corev1.VolumeSource{
109109
EmptyDir: &corev1.EmptyDirVolumeSource{},
110110
},

test/e2e/instascale_machinepool_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ func TestInstascaleMachinePool(t *testing.T) {
2020

2121
// Test configuration
2222
config, err := TestConfig(test, namespace.Name)
23-
test.Expect(err).To(BeNil())
23+
test.Expect(err).NotTo(HaveOccurred())
2424

2525
//create OCM connection
2626
connection, err := CreateConnection(test)
27-
test.Expect(err).To(BeNil())
27+
test.Expect(err).NotTo(HaveOccurred())
2828

2929
defer connection.Close()
3030

@@ -36,7 +36,7 @@ func TestInstascaleMachinePool(t *testing.T) {
3636

3737
// Setup batch job and AppWrapper
3838
job, aw, err := JobAppwrapperSetup(test, namespace, config)
39-
test.Expect(err).To(BeNil())
39+
test.Expect(err).NotTo(HaveOccurred())
4040

4141
// time.Sleep is used twice throughout the test, each for 30 seconds. Can look into using sync package waitGroup instead if that makes more sense
4242
// wait for required resources to scale up before checking them again

test/support/clusterpools.go

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import (
1010
cmv1 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1"
1111
mapiclientset "github.com/openshift/client-go/machine/clientset/versioned"
1212
"github.com/openshift/client-go/machine/listers/machine/v1beta1"
13-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
14-
"k8s.io/apimachinery/pkg/labels"
1513
)
1614

1715
var (
@@ -31,30 +29,20 @@ func CreateOCMConnection(secret string) (*ocmsdk.Connection, error) {
3129
Build()
3230
if err != nil {
3331
fmt.Fprintf(os.Stderr, "Can't build logger: %v\n", err)
34-
os.Exit(1)
32+
return nil, err
3533
}
3634
connection, err := ocmsdk.NewConnectionBuilder().
3735
Logger(logger).
3836
Tokens(string(secret)).
3937
Build()
4038
if err != nil || connection == nil {
4139
fmt.Fprintf(os.Stderr, "Can't build connection: %v\n", err)
42-
os.Exit(1)
40+
return nil, err
4341
}
4442

4543
return connection, nil
4644
}
4745

48-
func MachinePoolsExist(connection *ocmsdk.Connection) (bool, error) {
49-
machinePools := connection.ClustersMgmt().V1().Clusters().Cluster(ClusterID).MachinePools()
50-
return machinePools != nil, nil
51-
}
52-
53-
func NodePoolsExist(connection *ocmsdk.Connection) (bool, error) {
54-
nodePools := connection.ClustersMgmt().V1().Clusters().Cluster(ClusterID).NodePools()
55-
return nodePools != nil, nil
56-
}
57-
5846
func CheckMachinePools(connection *ocmsdk.Connection, awName string) (foundMachinePool bool, err error) {
5947
machinePoolsConnection := connection.ClustersMgmt().V1().Clusters().Cluster(ClusterID).MachinePools().List()
6048
machinePoolsListResponse, err := machinePoolsConnection.Send()
@@ -90,26 +78,3 @@ func CheckNodePools(connection *ocmsdk.Connection, awName string) (foundNodePool
9078

9179
return foundNodePool, err
9280
}
93-
94-
func MachineSetsCount() (numMachineSets int, err error) {
95-
machineSets, err := machineClient.MachineV1beta1().MachineSets(namespaceToList).List(context.Background(), metav1.ListOptions{})
96-
if err != nil {
97-
return 0, fmt.Errorf("error while listing machine sets, error: %v", err)
98-
}
99-
machineSetsSize := machineSets.ListMeta.Size()
100-
101-
return machineSetsSize, nil
102-
}
103-
104-
func CheckMachineSets(awName string) (foundMachineSet bool, err error) {
105-
machineSets, err := msLister.MachineSets("").List(labels.Everything())
106-
if err != nil {
107-
return false, fmt.Errorf("error listing machine sets, error: %v", err)
108-
}
109-
for _, machineSet := range machineSets {
110-
if strings.Contains(machineSet.Name, awName) {
111-
foundMachineSet = true
112-
}
113-
}
114-
return foundMachineSet, err
115-
}

test/support/support.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ var (
3131
ApplyOptions = metav1.ApplyOptions{FieldManager: "codeflare-test", Force: true}
3232

3333
TestTimeoutShort = 1 * time.Minute
34-
TestTimeoutThirtySeconds = 30 * time.Second
3534
TestTimeoutMedium = 2 * time.Minute
3635
TestTimeoutLong = 5 * time.Minute
3736
)

0 commit comments

Comments
 (0)