Created
May 10, 2019 15:30
-
-
Save michaelgugino/ea6f02f8bd8a4d44d5635de458b9ee75 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # put this in reconciler_test.go | |
| func TestExists2(t *testing.T) { | |
| scope, err := newLocalMachineScope() | |
| if err != nil { | |
| t.Fatalf("err: %v", err) | |
| } | |
| r := newReconciler(scope) | |
| exists, err := r.instanceExists() | |
| if err != nil { | |
| t.Fatalf("err: %v", err) | |
| } | |
| if !exists { | |
| t.Errorf("exists: %v", exists) | |
| } | |
| } | |
| func newLocalMachineScope() (*machineScope, error) { | |
| gclient, err := google.DefaultClient(context.TODO(), compute.ComputeScope) | |
| if err != nil { | |
| return nil, err | |
| } | |
| computeService, err := computeservice.NewComputeService(gclient) | |
| if err != nil { | |
| return nil, err | |
| } | |
| machineScope := machineScope{ | |
| machine: &v1beta1.Machine{ | |
| ObjectMeta: metav1.ObjectMeta{ | |
| Name: "notfound", | |
| Namespace: "", | |
| }, | |
| }, | |
| coreClient: controllerfake.NewFakeClient(), | |
| providerSpec: &gcpv1beta1.GCPMachineProviderSpec{ | |
| Zone: "us-east1-c", | |
| }, | |
| projectID: "notfound", | |
| computeService: computeService, | |
| } | |
| return &machineScope, nil | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment