You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2018/07/04 02:39:32 UTC
[trafficcontrol] 07/15: fix tenants test by resetting id_seq and
fixing error message
This is an automated email from the ASF dual-hosted git repository.
dangogh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit 6056ee0ffef1ed508195edd7f87caa8f87700f2f
Author: Dylan Volz <Dy...@comcast.com>
AuthorDate: Tue Jun 26 23:41:20 2018 -0600
fix tenants test by resetting id_seq and fixing error message
---
traffic_ops/testing/api/v13/tenants_test.go | 3 +--
traffic_ops/testing/api/v13/todb.go | 5 +++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/traffic_ops/testing/api/v13/tenants_test.go b/traffic_ops/testing/api/v13/tenants_test.go
index 99bbbf2..2a4003a 100644
--- a/traffic_ops/testing/api/v13/tenants_test.go
+++ b/traffic_ops/testing/api/v13/tenants_test.go
@@ -22,7 +22,6 @@ import (
)
func TestTenants(t *testing.T) {
-
CreateTestTenants(t)
UpdateTestTenants(t)
GetTestTenants(t)
@@ -120,7 +119,7 @@ func DeleteTestTenants(t *testing.T) {
if err == nil {
t.Errorf("%s has child tenants -- should not be able to delete", t1)
}
- expected := "Tenant 'tenant1' has child tenants"
+ expected := `Tenant '`+ strconv.Itoa(tenant1.ID) + `' has child tenants. Please update these child tenants and retry.`
if !strings.Contains(err.Error(), expected) {
t.Errorf("expected error: %s; got %s", expected, err.Error())
}
diff --git a/traffic_ops/testing/api/v13/todb.go b/traffic_ops/testing/api/v13/todb.go
index 0ebea91..4e25ec2 100644
--- a/traffic_ops/testing/api/v13/todb.go
+++ b/traffic_ops/testing/api/v13/todb.go
@@ -156,8 +156,8 @@ func SetupTenants(db *sql.DB) error {
// TODO: root tenant must be present in initial database. "badtenant" is needed for now so tests can be done
// with a tenant outside the user's tenant. That should be removed once User API tests are in place rather than the SetupUsers defined above.
sqlStmt := `
-INSERT INTO tenant (id, name, active, parent_id, last_updated) VALUES (1, 'root', true, null, '2018-01-19 19:01:21.327262');
-INSERT INTO tenant (id, name, active, parent_id, last_updated) VALUES (2, 'badtenant', true, 1, '2018-01-19 19:01:21.327262');
+INSERT INTO tenant (name, active, parent_id, last_updated) VALUES ('root', true, null, '2018-01-19 19:01:21.327262');
+INSERT INTO tenant (name, active, parent_id, last_updated) VALUES ('badtenant', true, 1, '2018-01-19 19:01:21.327262');
`
err := execSQL(db, sqlStmt, "tenant")
if err != nil {
@@ -363,6 +363,7 @@ func Teardown(db *sql.DB) error {
DELETE FROM snapshot;
DELETE FROM cdn;
DELETE FROM tenant;
+ ALTER SEQUENCE tenant_id_seq RESTART WITH 1;
`
err := execSQL(db, sqlStmt, "Tearing down")
if err != nil {