Skip to content

Commit

Permalink
chore(compute): switch to t.Fatal in smoke_test (#5438)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahdietz committed Feb 3, 2022
1 parent e9c9168 commit 49c9ac1
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions compute/apiv1/smoke_test.go
Expand Up @@ -91,8 +91,7 @@ func TestCreateGetPutPatchListInstance(t *testing.T) {
err = insert.Wait(ctx)
defer ForceDeleteInstance(ctx, name, c)
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}

getRequest := &computepb.GetInstanceRequest{
Expand All @@ -102,8 +101,7 @@ func TestCreateGetPutPatchListInstance(t *testing.T) {
}
get, err := c.Get(ctx, getRequest)
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}
if get.GetName() != name {
t.Fatalf("expected instance name: %s, got: %s", name, get.GetName())
Expand All @@ -129,8 +127,7 @@ func TestCreateGetPutPatchListInstance(t *testing.T) {

err = updateOp.Wait(ctx)
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}

patchReq := &computepb.UpdateShieldedInstanceConfigInstanceRequest{
Expand All @@ -148,14 +145,12 @@ func TestCreateGetPutPatchListInstance(t *testing.T) {

err = patchOp.Wait(ctx)
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}

fetched, err := c.Get(ctx, getRequest)
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}
if fetched.GetDescription() != "updated" {
t.Fatal(fmt.Sprintf("expected instance description: %s, got: %s", "updated", fetched.GetDescription()))
Expand All @@ -170,8 +165,7 @@ func TestCreateGetPutPatchListInstance(t *testing.T) {

itr := c.List(ctx, listRequest)
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}
found := false
element, err := itr.Next()
Expand Down Expand Up @@ -258,8 +252,7 @@ func TestCreateGetRemoveSecurityPolicies(t *testing.T) {
err = insert.Wait(ctx)
defer ForceDeleteSecurityPolicy(ctx, name, c)
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}

removeRuleRequest := &computepb.RemoveRuleSecurityPolicyRequest{
Expand All @@ -274,8 +267,7 @@ func TestCreateGetRemoveSecurityPolicies(t *testing.T) {
}
err = rule.Wait(ctx)
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}

getRequest := &computepb.GetSecurityPolicyRequest{
Expand Down Expand Up @@ -481,8 +473,7 @@ func TestCapitalLetter(t *testing.T) {
}
err = insert.Wait(ctx)
if err != nil {
t.Error(err)
t.FailNow()
t.Fatal(err)
}
defer func() {
timeoutCtx, cancel := context.WithTimeout(ctx, time.Minute)
Expand Down

0 comments on commit 49c9ac1

Please sign in to comment.