diff --git a/test/machines/awsclient.go b/test/machines/awsclient.go index 98dee339bd..6a6eda134e 100644 --- a/test/machines/awsclient.go +++ b/test/machines/awsclient.go @@ -27,35 +27,27 @@ func (client *awsClientWrapper) GetRunningInstances(machine *clusterv1alpha1.Mac } func (client *awsClientWrapper) GetPublicDNSName(machine *clusterv1alpha1.Machine) (string, error) { - runningInstances, err := machineutils.GetRunningInstances(machine, client.client) + instance, err := machineutils.GetInstance(machine, client.client) if err != nil { return "", err } - if len(runningInstances) == 0 { - return "", fmt.Errorf("no running machine instance found") - } - - if *runningInstances[0].PublicDnsName == "" { + if *instance.PublicDnsName == "" { return "", fmt.Errorf("machine instance public DNS name not set") } - return *runningInstances[0].PublicDnsName, nil + return *instance.PublicDnsName, nil } func (client *awsClientWrapper) GetPrivateIP(machine *clusterv1alpha1.Machine) (string, error) { - runningInstances, err := machineutils.GetRunningInstances(machine, client.client) + instance, err := machineutils.GetInstance(machine, client.client) if err != nil { return "", err } - if len(runningInstances) == 0 { - return "", fmt.Errorf("no running machine instance found") - } - - if *runningInstances[0].PrivateIpAddress == "" { + if *instance.PrivateIpAddress == "" { return "", fmt.Errorf("machine instance public DNS name not set") } - return *runningInstances[0].PrivateIpAddress, nil + return *instance.PrivateIpAddress, nil } diff --git a/test/machines/machines_test.go b/test/machines/machines_test.go index bd38be1fbe..4c0bae7eea 100644 --- a/test/machines/machines_test.go +++ b/test/machines/machines_test.go @@ -135,13 +135,16 @@ var _ = framework.SigKubeDescribe("Machines", func() { testMachine := manifests.TestingMachine(cluster.Name, cluster.Namespace, testMachineProviderConfig) awsClient, err := awsclient.NewClient(f.KubeClient, awsCredSecret.Name, awsCredSecret.Namespace, region) Expect(err).NotTo(HaveOccurred()) + acw := &awsClientWrapper{client: awsClient} + f.CreateMachineAndWait(testMachine, acw) + machinesToDelete.AddMachine(testMachine, f, acw) f.CreateMachineAndWait(testMachine, &awsClientWrapper{client: awsClient}) machinesToDelete.AddMachine(testMachine, f, &awsClientWrapper{client: awsClient}) // TODO(jchaloup): Run some tests here!!! E.g. check for properly set security groups, iam role, tags - f.DeleteMachineAndWait(testMachine, &awsClientWrapper{client: awsClient}) + f.DeleteMachineAndWait(testMachine, acw) }) It("Can deploy compute nodes through machineset", func() { @@ -207,7 +210,7 @@ var _ = framework.SigKubeDescribe("Machines", func() { awsClient, err := awsclient.NewClient(f.KubeClient, awsCredSecret.Name, awsCredSecret.Namespace, region) Expect(err).NotTo(HaveOccurred()) acw := &awsClientWrapper{client: awsClient} - f.CreateMachineAndWait(masterMachine, &awsClientWrapper{client: awsClient}) + f.CreateMachineAndWait(masterMachine, acw) machinesToDelete.AddMachine(masterMachine, f, acw) By("Collecting master kubeconfig")