blob: 590fc8bc41872a6237275c5534c2fa5072835609 [file] [log] [blame]
Samuel A. Falvo IIc007c272014-02-10 20:49:26 -08001package servers
2
3import (
Ash Wilsonad21c712014-09-25 10:15:22 -04004 "reflect"
Samuel A. Falvo IIe246ac02014-02-13 23:20:09 -08005 "testing"
Samuel A. Falvo IIc007c272014-02-10 20:49:26 -08006)
7
Ash Wilsonad21c712014-09-25 10:15:22 -04008// This provides more fine-grained failures when Servers differ, because Server structs are too damn big to compare by eye.
9// FIXME I should absolutely refactor this into a general-purpose thing in testhelper.
10func equalServers(t *testing.T, expected Server, actual Server) {
11 if expected.ID != actual.ID {
12 t.Errorf("ID differs. expected=[%s], actual=[%s]", expected.ID, actual.ID)
13 }
14 if expected.TenantID != actual.TenantID {
15 t.Errorf("TenantID differs. expected=[%s], actual=[%s]", expected.TenantID, actual.TenantID)
16 }
17 if expected.UserID != actual.UserID {
18 t.Errorf("UserID differs. expected=[%s], actual=[%s]", expected.UserID, actual.UserID)
19 }
20 if expected.Name != actual.Name {
21 t.Errorf("Name differs. expected=[%s], actual=[%s]", expected.Name, actual.Name)
22 }
23 if expected.Updated != actual.Updated {
24 t.Errorf("Updated differs. expected=[%s], actual=[%s]", expected.Updated, actual.Updated)
25 }
26 if expected.Created != actual.Created {
27 t.Errorf("Created differs. expected=[%s], actual=[%s]", expected.Created, actual.Created)
28 }
29 if expected.HostID != actual.HostID {
30 t.Errorf("HostID differs. expected=[%s], actual=[%s]", expected.HostID, actual.HostID)
31 }
32 if expected.Status != actual.Status {
33 t.Errorf("Status differs. expected=[%s], actual=[%s]", expected.Status, actual.Status)
34 }
35 if expected.Progress != actual.Progress {
36 t.Errorf("Progress differs. expected=[%s], actual=[%s]", expected.Progress, actual.Progress)
37 }
38 if expected.AccessIPv4 != actual.AccessIPv4 {
39 t.Errorf("AccessIPv4 differs. expected=[%s], actual=[%s]", expected.AccessIPv4, actual.AccessIPv4)
40 }
41 if expected.AccessIPv6 != actual.AccessIPv6 {
42 t.Errorf("AccessIPv6 differs. expected=[%s], actual=[%s]", expected.AccessIPv6, actual.AccessIPv6)
43 }
44 if !reflect.DeepEqual(expected.Image, actual.Image) {
45 t.Errorf("Image differs. expected=[%s], actual=[%s]", expected.Image, actual.Image)
46 }
47 if !reflect.DeepEqual(expected.Flavor, actual.Flavor) {
48 t.Errorf("Flavor differs. expected=[%s], actual=[%s]", expected.Flavor, actual.Flavor)
49 }
50 if !reflect.DeepEqual(expected.Addresses, actual.Addresses) {
51 t.Errorf("Addresses differ. expected=[%s], actual=[%s]", expected.Addresses, actual.Addresses)
52 }
53 if !reflect.DeepEqual(expected.Metadata, actual.Metadata) {
54 t.Errorf("Metadata differs. expected=[%s], actual=[%s]", expected.Metadata, actual.Metadata)
55 }
56 if !reflect.DeepEqual(expected.Links, actual.Links) {
57 t.Errorf("Links differs. expected=[%s], actual=[%s]", expected.Links, actual.Links)
58 }
59 if expected.KeyName != actual.KeyName {
60 t.Errorf("KeyName differs. expected=[%s], actual=[%s]", expected.KeyName, actual.KeyName)
61 }
62 if expected.AdminPass != actual.AdminPass {
63 t.Errorf("AdminPass differs. expected=[%s], actual=[%s]", expected.AdminPass, actual.AdminPass)
64 }
65}