Skip to content

Commit

Permalink
Merge pull request rapidpro#314 from nyaruka/test_tweaks
Browse files Browse the repository at this point in the history
Tweak tests so UUIDs aren't reset between web tests
  • Loading branch information
rowanseymour authored Jul 1, 2020
2 parents c226f63 + 76f12e8 commit b3baadb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/mattn/go-sqlite3 v1.10.0 // indirect
github.com/nyaruka/ezconf v0.2.1
github.com/nyaruka/gocommon v1.2.0
github.com/nyaruka/goflow v0.94.1
github.com/nyaruka/goflow v0.94.2
github.com/nyaruka/librato v1.0.0
github.com/nyaruka/logrus_sentry v0.8.2-0.20190129182604-c2962b80ba7d
github.com/nyaruka/null v1.2.0
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,8 @@ github.com/nyaruka/ezconf v0.2.1 h1:TDXWoqjqYya1uhou1mAJZg7rgFYL98EB0Tb3+BWtUh0=
github.com/nyaruka/ezconf v0.2.1/go.mod h1:ey182kYkw2MIi4XiWe1FR/mzI33WCmTWuceDYYxgnQw=
github.com/nyaruka/gocommon v1.2.0 h1:gCmVCXYZFwKDMqQj8R1jNlK+7a06khKFq3zX8fBBbzw=
github.com/nyaruka/gocommon v1.2.0/go.mod h1:9Y21Fd6iZXDLHWTRiZAc6b4LQSCi6HEEQK4SB45Yav4=
github.com/nyaruka/goflow v0.94.0 h1:fmUdADrFsJjClsbxJMd0R0uMyYWtQNr4aiURBI31ZKo=
github.com/nyaruka/goflow v0.94.0/go.mod h1:PDah2hr5WzODnUFK4VWWQkg7SqnYclf7P9Ik5u/VOG0=
github.com/nyaruka/goflow v0.94.1 h1:FzbA4Age1i5GuQ9su/E4z7HRa7f5ghv+GeNGUn5nPfA=
github.com/nyaruka/goflow v0.94.1/go.mod h1:PDah2hr5WzODnUFK4VWWQkg7SqnYclf7P9Ik5u/VOG0=
github.com/nyaruka/goflow v0.94.2 h1:NduUutwkEQIMNBV1XLTIVPVAbRFyCFtjD45lri04xRo=
github.com/nyaruka/goflow v0.94.2/go.mod h1:PDah2hr5WzODnUFK4VWWQkg7SqnYclf7P9Ik5u/VOG0=
github.com/nyaruka/librato v1.0.0 h1:Vznj9WCeC1yZXbBYyYp40KnbmXLbEkjKmHesV/v2SR0=
github.com/nyaruka/librato v1.0.0/go.mod h1:pkRNLFhFurOz0QqBz6/DuTFhHHxAubWxs4Jx+J7yUgg=
github.com/nyaruka/logrus_sentry v0.8.2-0.20190129182604-c2962b80ba7d h1:hyp9u36KIwbTCo2JAJ+TuJcJBc+UZzEig7RI/S5Dvkc=
Expand Down
4 changes: 2 additions & 2 deletions services/tickets/mailgun/testdata/receive.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"response": {
"action": "forwarded",
"ticket_uuid": "c69f103c-db64-4481-815b-1112890419ef",
"msg_uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5"
"msg_uuid": "692926ea-09d6-4942-bd38-d266ec8d3716"
},
"db_assertions": [
{
Expand All @@ -78,7 +78,7 @@
"https://api.mailgun.net/v3/tickets.rapidpro.io/messages": [
{
"status": 200,
"body": "{\"id\": \"\u003c20200426161758.1.590432020254B2BF@tickets.rapidpro.io\u003e\", \"message\": \"Queued. Thank you.\"}"
"body": "{\"id\": \"<20200426161758.1.590432020254B2BF@tickets.rapidpro.io>\", \"message\": \"Queued. Thank you.\"}"
}
]
},
Expand Down
10 changes: 5 additions & 5 deletions web/flow/testdata/clone.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,24 +212,24 @@
"groups": [
{
"name": "Testers",
"uuid": "8720f157-ca1c-432f-9c0b-2014ddc77094"
"uuid": "312d3af0-a565-4c96-ba00-bd7f0d08e671"
}
],
"type": "add_contact_groups",
"uuid": "692926ea-09d6-4942-bd38-d266ec8d3716"
"uuid": "5ecda5fc-951c-437b-a17e-f85e49829fb9"
},
{
"text": "Your birthdate is soon",
"type": "send_msg",
"uuid": "c34b6c7d-fa06-4563-92a3-d648ab64bccb"
"uuid": "a4d15ed4-5b24-407f-b86e-4b881f09a186"
}
],
"exits": [
{
"uuid": "5802813d-6c58-4292-8228-9728778b6c98"
"uuid": "b88ce93d-4360-4455-a691-235cbe720980"
}
],
"uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5"
"uuid": "970b8069-50f5-4f6f-8f41-6b2d9f33d623"
}
],
"revision": 106,
Expand Down
3 changes: 2 additions & 1 deletion web/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ func RunWebTests(t *testing.T, truthFile string) {
wg := &sync.WaitGroup{}

defer uuids.SetGenerator(uuids.DefaultGenerator)
uuids.SetGenerator(uuids.NewSeededGenerator(123456))

defer dates.SetNowSource(dates.DefaultNowSource)

server := NewServer(context.Background(), config.Mailroom, db, rp, nil, nil, wg)
Expand Down Expand Up @@ -67,7 +69,6 @@ func RunWebTests(t *testing.T, truthFile string) {
require.NoError(t, err)

for i, tc := range tcs {
uuids.SetGenerator(uuids.NewSeededGenerator(123456))
dates.SetNowSource(dates.NewSequentialNowSource(time.Date(2018, 7, 6, 12, 30, 0, 123456789, time.UTC)))

var clonedMocks *httpx.MockRequestor
Expand Down

0 comments on commit b3baadb

Please sign in to comment.