Skip to content

Commit

Permalink
use reflect deepeq
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrannosaurus-becks committed Apr 27, 2020
1 parent 3be2aaa commit cb35949
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions plugin/path_config_test.go
Expand Up @@ -2,7 +2,6 @@ package gcpauth

import (
"context"
"fmt"
"reflect"
"testing"

Expand Down Expand Up @@ -39,10 +38,26 @@ func TestBackend_PathConfigRead(t *testing.T) {
if len(resp.Data) != 2 {
t.Fatal("expected 2 fields")
}
if fmt.Sprintf("%s", resp.Data["iam_metadata"]) != "[project_id role service_account_id service_account_email]" {
if !reflect.DeepEqual(resp.Data["iam_metadata"], []string{
"project_id",
"role",
"service_account_id",
"service_account_email",
}) {
t.Fatalf("expected the default iam_metadata but received %s", resp.Data["iam_metadata"])
}
if fmt.Sprintf("%s", resp.Data["gce_metadata"]) != "[instance_creation_timestamp instance_id instance_name project_id project_number role service_account_id service_account_email zone]" {

if !reflect.DeepEqual(resp.Data["gce_metadata"], []string{
"instance_creation_timestamp",
"instance_id",
"instance_name",
"project_id",
"project_number",
"role",
"service_account_id",
"service_account_email",
"zone",
}) {
t.Fatalf("expected the default gce_metadata but received %s", resp.Data["gce_metadata"])
}
})
Expand Down

0 comments on commit cb35949

Please sign in to comment.