Samuel A. Falvo II | c007c27 | 2014-02-10 20:49:26 -0800 | [diff] [blame] | 1 | package servers |
| 2 | |
| 3 | import ( |
Ash Wilson | ad21c71 | 2014-09-25 10:15:22 -0400 | [diff] [blame] | 4 | "reflect" |
Samuel A. Falvo II | e246ac0 | 2014-02-13 23:20:09 -0800 | [diff] [blame] | 5 | "testing" |
Samuel A. Falvo II | c007c27 | 2014-02-10 20:49:26 -0800 | [diff] [blame] | 6 | ) |
| 7 | |
Ash Wilson | ad21c71 | 2014-09-25 10:15:22 -0400 | [diff] [blame] | 8 | // 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. |
| 10 | func 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 | } |