You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2016/11/28 21:23:03 UTC
[05/11] incubator-trafficcontrol git commit: added second entry to
hardware
added second entry to hardware
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/f6f3f156
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/f6f3f156
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/f6f3f156
Branch: refs/heads/psql-rebase
Commit: f6f3f156f57a821f73668ee5be1ba7d3addf8985
Parents: 09d6bdf
Author: David Neuman <da...@gmail.com>
Authored: Tue Nov 22 11:50:43 2016 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Tue Nov 22 11:50:43 2016 -0700
----------------------------------------------------------------------
traffic_ops/client/fixtures/hardware.go | 13 ++++++++++---
traffic_ops/client/tests/hardware_test.go | 23 ++++++++++++-----------
2 files changed, 22 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f6f3f156/traffic_ops/client/fixtures/hardware.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/fixtures/hardware.go b/traffic_ops/client/fixtures/hardware.go
index 74c4a36..eb5f454 100644
--- a/traffic_ops/client/fixtures/hardware.go
+++ b/traffic_ops/client/fixtures/hardware.go
@@ -23,10 +23,17 @@ func Hardware() *client.HardwareResponse {
Response: []client.Hardware{
client.Hardware{
ID: 18,
- HostName: "odol-atsmid-cen-09",
+ HostName: "edge-den-01",
LastUpdated: "2015-07-16 09:04:20",
- Value: "1.00",
- Description: "BACKPLANE FIRMWARE",
+ Value: "DIS1",
+ Description: "Phys Disk",
+ },
+ client.Hardware{
+ ID: 19,
+ HostName: "edge-den-02",
+ LastUpdated: "2015-07-16 09:04:20",
+ Value: "DIS2",
+ Description: "Physical Disk",
},
},
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f6f3f156/traffic_ops/client/tests/hardware_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/hardware_test.go b/traffic_ops/client/tests/hardware_test.go
index 58a042c..619b05c 100644
--- a/traffic_ops/client/tests/hardware_test.go
+++ b/traffic_ops/client/tests/hardware_test.go
@@ -17,6 +17,7 @@ package test
import (
"net/http"
+ "strings"
"testing"
"github.com/apache/incubator-trafficcontrol/traffic_ops/client"
@@ -44,27 +45,27 @@ func TestHardware(t *testing.T) {
testHelper.Success(t, "Should be able to make a request to Traffic Ops")
}
- if len(hardware) != 1 {
- testHelper.Error(t, "Should get back \"1\" Hardware, got: %d", len(hardware))
+ if len(hardware) != 2 {
+ testHelper.Error(t, "Should get back \"2\" Hardware, got: %d", len(hardware))
} else {
- testHelper.Success(t, "Should get back \"1\" Hardware")
+ testHelper.Success(t, "Should get back \"2\" Hardware")
}
for _, h := range hardware {
- if h.HostName != "odol-atsmid-cen-09" {
- testHelper.Error(t, "Should get back \"odol-atsmid-cen-09\" for \"Hostname\", got: %s", h.HostName)
+ if !strings.Contains(h.HostName, "edge-den") {
+ testHelper.Error(t, "Should get back \"edge-den\" in \"Hostname\", got: %s", h.HostName)
} else {
- testHelper.Success(t, "Should get back \"odol-atsmid-cen-09\" for \"Hostname\"")
+ testHelper.Success(t, "Should get back \"edge-den\" in \"Hostname\"")
}
- if h.Value != "1.00" {
- testHelper.Error(t, "Should get back \"1.00\" for \"Value\", got: %s", h.Value)
+ if !strings.Contains(h.Value, "DIS") {
+ testHelper.Error(t, "Should get back \"DIS1\" or \"DIS2\" for \"Value\", got: %s", h.Value)
} else {
- testHelper.Success(t, "Should get back \"1.00\" for \"Value\"")
+ testHelper.Success(t, "Should get back \"DIS1\" or \"DIS2\" for \"Value\"")
}
- if h.Description != "BACKPLANE FIRMWARE" {
- testHelper.Error(t, "Should get back \"BACKPLANE FIRMWARE\" for \"Description\", got: %s", h.Description)
+ if !strings.Contains(h.Description, "Phys") {
+ testHelper.Error(t, "Should get back \"Phys Disk\" or \"Physical Disk\" for \"Description\", got: %s", h.Description)
} else {
testHelper.Success(t, "Should get back \"BACKPLANE FIRMWARE\" for \"Description\"")
}