X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm%2Fsync_test.go;h=753f942fe06706d123967df5d95df9a43ee7c2e7;hb=992eaae7fec45c2d58fff89d1bc0ae920a899296;hp=dba1d7e054bd7e4b8e99238b7d0692c6aa2ef8b4;hpb=30df06d9dc760f7adf8ce51f2443dedc773f1350;p=safcm%2Fsafcm.git diff --git a/cmd/safcm/sync_test.go b/cmd/safcm/sync_test.go index dba1d7e..753f942 100644 --- a/cmd/safcm/sync_test.go +++ b/cmd/safcm/sync_test.go @@ -166,15 +166,17 @@ func TestHostsToSync(t *testing.T) { } for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { res, err := hostsToSync(tc.names, allHosts, allGroups) if !reflect.DeepEqual(tc.exp, res) { - t.Errorf("%s: res: %s", tc.name, + t.Errorf("res: %s", cmp.Diff(tc.exp, res)) } // Ugly but the simplest way to compare errors (including nil) if fmt.Sprintf("%s", err) != fmt.Sprintf("%s", tc.expErr) { - t.Errorf("%s: err = %#v, want %#v", - tc.name, err, tc.expErr) + t.Errorf("err = %#v, want %#v", + err, tc.expErr) } + }) } }