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/16 19:29:39 UTC
[trafficcontrol] branch master updated: removed ExpectPrepare in
test cases to match commit 7030ac28
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
The following commit(s) were added to refs/heads/master by this push:
new c6bc361 removed ExpectPrepare in test cases to match commit 7030ac28
c6bc361 is described below
commit c6bc3616d7878fe7adb43ce5a3149eec7c1be9f7
Author: Jesse Rivas <je...@comcast.com>
AuthorDate: Mon Jul 16 13:09:47 2018 -0600
removed ExpectPrepare in test cases to match commit 7030ac28
---
.../traffic_ops_golang/server/servers_assignment_test.go | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/traffic_ops/traffic_ops_golang/server/servers_assignment_test.go b/traffic_ops/traffic_ops_golang/server/servers_assignment_test.go
index 55a8757..672ea71 100644
--- a/traffic_ops/traffic_ops_golang/server/servers_assignment_test.go
+++ b/traffic_ops/traffic_ops_golang/server/servers_assignment_test.go
@@ -43,8 +43,8 @@ func TestAssignDsesToServer(t *testing.T) {
pqNewDses := pq.Array(newDses)
mock.ExpectBegin()
- mock.ExpectPrepare("DELETE").ExpectExec().WithArgs(100).WillReturnResult(sqlmock.NewResult(1, 3))
- mock.ExpectPrepare("INSERT").ExpectExec().WithArgs(pqNewDses, 100).WillReturnResult(sqlmock.NewResult(1, 3))
+ mock.ExpectExec("DELETE").WithArgs(100).WillReturnResult(sqlmock.NewResult(1, 3))
+ mock.ExpectExec("INSERT").WithArgs(pqNewDses, 100).WillReturnResult(sqlmock.NewResult(1, 3))
//fetch remap config location
remapConfigLocation := "a/path/to/a/remap.config"
@@ -57,7 +57,7 @@ func TestAssignDsesToServer(t *testing.T) {
dsFieldRows.AddRow("ds1", nil, "regexRemapPlaceholder", "cacheurlPlaceholder")
dsFieldRows.AddRow("ds2", "edgeHeaderRewritePlaceholder2", "regexRemapPlaceholder", "cacheurlPlaceholder")
dsFieldRows.AddRow("ds3", "", nil, "cacheurlPlaceholder")
- mock.ExpectPrepare("SELECT").ExpectQuery().WithArgs(pqNewDses).WillReturnRows(dsFieldRows)
+ mock.ExpectQuery("SELECT").WithArgs(pqNewDses).WillReturnRows(dsFieldRows)
//prepare the insert and delete parameter slices as they should be constructed in the function
headerRewritePrefix := "hdr_rw_"
@@ -68,7 +68,7 @@ func TestAssignDsesToServer(t *testing.T) {
delete := []string{headerRewritePrefix + "ds1" + configPostfix, headerRewritePrefix + "ds3" + configPostfix, regexRemapPrefix + "ds3" + configPostfix}
fileNamesPq := pq.Array(insert)
//insert the parameters
- mock.ExpectPrepare("INSERT").ExpectExec().WithArgs(fileNamesPq, "location", remapConfigLocation).WillReturnResult(sqlmock.NewResult(1, 6))
+ mock.ExpectExec("INSERT").WithArgs(fileNamesPq, "location", remapConfigLocation).WillReturnResult(sqlmock.NewResult(1, 6))
//select out the parameterIDs we just inserted
parameterIDRows := sqlmock.NewRows([]string{"id"})
@@ -76,13 +76,13 @@ func TestAssignDsesToServer(t *testing.T) {
for _, i := range parameterIDs {
parameterIDRows.AddRow(i)
}
- mock.ExpectPrepare("SELECT").ExpectQuery().WithArgs(fileNamesPq).WillReturnRows(parameterIDRows)
+ mock.ExpectQuery("SELECT").WithArgs(fileNamesPq).WillReturnRows(parameterIDRows)
//insert those ids as profile_parameters
- mock.ExpectPrepare("INSERT").ExpectExec().WithArgs(pqNewDses, pq.Array(parameterIDs)).WillReturnResult(sqlmock.NewResult(6, 6))
+ mock.ExpectExec("INSERT").WithArgs(pqNewDses, pq.Array(parameterIDs)).WillReturnResult(sqlmock.NewResult(6, 6))
//delete the parameters in the delete list
- mock.ExpectPrepare("DELETE").ExpectExec().WithArgs(pq.Array(delete)).WillReturnResult(sqlmock.NewResult(1, 3))
+ mock.ExpectExec("DELETE").WithArgs(pq.Array(delete)).WillReturnResult(sqlmock.NewResult(1, 3))
mock.ExpectCommit()
result, err := assignDeliveryServicesToServer(100, newDses, true, db)