Skip to content

Commit

Permalink
Merge pull request rapidpro#276 from nyaruka/housekeeping
Browse files Browse the repository at this point in the history
🧹 Go 1.14 and some minor dependency updates
  • Loading branch information
rowanseymour authored Apr 30, 2020
2 parents 977f82e + 6d29926 commit 3ec5c42
Show file tree
Hide file tree
Showing 19 changed files with 138 additions and 92 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: 1.13.x
go-version: 1.14.x

- name: Run tests
run: go test -p=1 -coverprofile=coverage.text -covermode=atomic ./...
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: 1.13.x
go-version: 1.14.x

- name: Publish release
uses: goreleaser/goreleaser-action@v1
Expand Down
23 changes: 10 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@ module github.com/nyaruka/mailroom

require (
github.com/Masterminds/semver v1.5.0
github.com/apex/log v1.0.0
github.com/aws/aws-sdk-go v1.16.17
github.com/apex/log v1.1.4
github.com/aws/aws-sdk-go v1.30.17
github.com/buger/jsonparser v0.0.0-20200322175846-f7e751efca13
github.com/certifi/gocertifi v0.0.0-20190105021004-abcd57078448 // indirect
github.com/certifi/gocertifi v0.0.0-20200211180108-c7c1fbc02894 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/edganiukov/fcm v0.3.0
github.com/edganiukov/fcm v0.4.0
github.com/fortytw2/leaktest v1.3.0 // indirect
github.com/getsentry/raven-go v0.1.2-0.20190125112653-238ebd86338d // indirect
github.com/go-chi/chi v3.3.3+incompatible
github.com/go-sql-driver/mysql v1.4.1 // indirect
github.com/golang/protobuf v1.3.2
github.com/golang/protobuf v1.4.0
github.com/gomodule/redigo v2.0.0+incompatible
github.com/google/go-cmp v0.3.0 // indirect
github.com/gorilla/schema v1.1.0
github.com/jmoiron/sqlx v1.2.0
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 // indirect
github.com/lib/pq v1.0.0
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/lib/pq v1.4.0
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e // indirect
github.com/mattn/go-sqlite3 v1.10.0 // indirect
github.com/nyaruka/ezconf v0.2.1
Expand All @@ -27,17 +25,16 @@ require (
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
github.com/olivere/elastic v6.2.21+incompatible
github.com/olivere/elastic v6.2.30+incompatible
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.9.1
github.com/prometheus/client_model v0.2.0
github.com/prometheus/common v0.9.1
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24
github.com/sirupsen/logrus v1.4.2
github.com/sirupsen/logrus v1.5.0
github.com/stretchr/testify v1.5.1
google.golang.org/appengine v1.4.0 // indirect
gopkg.in/go-playground/validator.v9 v9.31.0
gopkg.in/mail.v2 v2.3.1
)

go 1.13
go 1.14
91 changes: 74 additions & 17 deletions go.sum

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions hooks/airtime_transferred_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ func TestAirtimeTransferred(t *testing.T) {
},
},
SQLAssertions: []SQLAssertion{
SQLAssertion{
{
SQL: `select count(*) from airtime_airtimetransfer where org_id = $1 AND contact_id = $2 AND status = 'S'`,
Args: []interface{}{models.Org1, models.CathyID},
Count: 1,
},
SQLAssertion{
{
SQL: `select count(*) from request_logs_httplog where org_id = $1 AND airtime_transfer_id IS NOT NULL AND is_error = FALSE AND url = 'https://airtime-api.dtone.com/cgi-bin/shop/topup'`,
Args: []interface{}{models.Org1},
Count: 3,
Expand All @@ -109,12 +109,12 @@ func TestAirtimeTransferred(t *testing.T) {
},
},
SQLAssertions: []SQLAssertion{
SQLAssertion{
{
SQL: `select count(*) from airtime_airtimetransfer where org_id = $1 AND contact_id = $2 AND status = 'F'`,
Args: []interface{}{models.Org1, models.GeorgeID},
Count: 1,
},
SQLAssertion{
{
SQL: `select count(*) from request_logs_httplog where org_id = $1 AND airtime_transfer_id IS NOT NULL AND is_error = TRUE AND url = 'https://airtime-api.dtone.com/cgi-bin/shop/topup'`,
Args: []interface{}{models.Org1},
Count: 1,
Expand Down
2 changes: 1 addition & 1 deletion hooks/broadcast_created_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestBroadcastCreated(t *testing.T) {
},
},
SQLAssertions: []SQLAssertion{
SQLAssertion{
{
SQL: "select count(*) from flows_flowrun where contact_id = $1 AND is_active = FALSE",
Args: []interface{}{models.CathyID},
Count: 1,
Expand Down
6 changes: 3 additions & 3 deletions hooks/campaigns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ func TestCampaigns(t *testing.T) {
},
},
SQLAssertions: []SQLAssertion{
SQLAssertion{
{
SQL: `select count(*) FROM campaigns_eventfire WHERE contact_id = $1`,
Args: []interface{}{models.CathyID},
Count: 1,
},
SQLAssertion{
{
SQL: `select count(*) FROM campaigns_eventfire WHERE contact_id = $1`,
Args: []interface{}{models.BobID},
Count: 3,
},
SQLAssertion{
{
SQL: `select count(*) FROM campaigns_eventfire WHERE contact_id = $1`,
Args: []interface{}{models.GeorgeID},
Count: 0,
Expand Down
2 changes: 1 addition & 1 deletion hooks/classifier_called_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestClassifierCalled(t *testing.T) {
},
},
SQLAssertions: []SQLAssertion{
SQLAssertion{
{
SQL: `select count(*) from request_logs_httplog where org_id = $1 AND is_error = FALSE AND classifier_id = $2 AND url = 'https://api.wit.ai/message?v=20170307&q=book+me+a+flight'`,
Args: []interface{}{models.Org1, models.WitID},
Count: 1,
Expand Down
16 changes: 8 additions & 8 deletions hooks/contact_field_changed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,42 +43,42 @@ func TestContactFieldChanged(t *testing.T) {
},
},
SQLAssertions: []SQLAssertion{
SQLAssertion{
{
SQL: `select count(*) from contacts_contact where id = $1 AND fields->$2 = '{"text":"Female"}'::jsonb`,
Args: []interface{}{models.CathyID, models.GenderFieldUUID},
Count: 1,
},
SQLAssertion{
{
SQL: `select count(*) from contacts_contact where id = $1 AND NOT fields?$2`,
Args: []interface{}{models.CathyID, models.AgeFieldUUID},
Count: 1,
},
SQLAssertion{
{
SQL: `select count(*) from contacts_contact where id = $1 AND NOT fields?$2`,
Args: []interface{}{models.GeorgeID, models.GenderFieldUUID},
Count: 1,
},
SQLAssertion{
{
SQL: `select count(*) from contacts_contact where id = $1 AND fields->$2 = '{"text":"40", "number": 40}'::jsonb`,
Args: []interface{}{models.GeorgeID, models.AgeFieldUUID},
Count: 1,
},
SQLAssertion{
{
SQL: `select count(*) from contacts_contact where id = $1 AND fields->$2 = '{"text":"Male"}'::jsonb`,
Args: []interface{}{models.BobID, models.GenderFieldUUID},
Count: 1,
},
SQLAssertion{
{
SQL: `select count(*) from contacts_contact where id = $1 AND fields->$2 = '{"text":"Old"}'::jsonb`,
Args: []interface{}{models.BobID, models.AgeFieldUUID},
Count: 1,
},
SQLAssertion{
{
SQL: `select count(*) from contacts_contact where id = $1 AND NOT fields?$2`,
Args: []interface{}{models.BobID, "unknown"},
Count: 1,
},
SQLAssertion{
{
SQL: `select count(*) from contacts_contact where id = $1 AND fields = '{}'`,
Args: []interface{}{models.AlexandriaID},
Count: 1,
Expand Down
8 changes: 4 additions & 4 deletions hooks/contact_groups_changed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ func TestContactGroupsChanged(t *testing.T) {
},
},
SQLAssertions: []SQLAssertion{
SQLAssertion{
{
SQL: "select count(*) from contacts_contactgroup_contacts where contact_id = $1 and contactgroup_id = $2",
Args: []interface{}{models.CathyID, models.DoctorsGroupID},
Count: 0,
},
SQLAssertion{
{
SQL: "select count(*) from contacts_contactgroup_contacts where contact_id = $1 and contactgroup_id = $2",
Args: []interface{}{models.CathyID, models.TestersGroupID},
Count: 1,
},
SQLAssertion{
{
SQL: "select count(*) from contacts_contactgroup_contacts where contact_id = $1 and contactgroup_id = $2",
Args: []interface{}{models.GeorgeID, models.TestersGroupID},
Count: 1,
},
SQLAssertion{
{
SQL: "select count(*) from contacts_contactgroup_contacts where contact_id = $1 and contactgroup_id = $2",
Args: []interface{}{models.BobID, models.TestersGroupID},
Count: 0,
Expand Down
6 changes: 3 additions & 3 deletions hooks/contact_language_changed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ func TestContactLanguageChanged(t *testing.T) {
},
},
SQLAssertions: []SQLAssertion{
SQLAssertion{
{
SQL: "select count(*) from contacts_contact where id = $1 and language = 'eng'",
Args: []interface{}{models.CathyID},
Count: 1,
},
SQLAssertion{
{
SQL: "select count(*) from contacts_contact where id = $1 and language = 'spa'",
Args: []interface{}{models.GeorgeID},
Count: 1,
},
SQLAssertion{
{
SQL: "select count(*) from contacts_contact where id = $1 and language is NULL;",
Args: []interface{}{models.BobID},
Count: 1,
Expand Down
10 changes: 5 additions & 5 deletions hooks/contact_name_changed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@ func TestContactNameChanged(t *testing.T) {
},
},
SQLAssertions: []SQLAssertion{
SQLAssertion{
{
SQL: "select count(*) from contacts_contact where name = 'Tarzan' and id = $1",
Args: []interface{}{models.CathyID},
Count: 1,
},
SQLAssertion{
{
SQL: "select count(*) from contacts_contact where name = 'Tarzan'",
Count: 1,
},
SQLAssertion{
{
SQL: "select count(*) from contacts_contact where name = 'Bob' and id = $1",
Args: []interface{}{models.BobID},
Count: 1,
},
SQLAssertion{
{
SQL: "select count(*) from contacts_contact where name = 'Geoff Newman' and id = $1",
Args: []interface{}{models.GeorgeID},
Count: 1,
},
SQLAssertion{
{
SQL: "select count(*) from contacts_contact where name = '😃2345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678' and id = $1",
Args: []interface{}{models.AlexandriaID},
Count: 1,
Expand Down
10 changes: 5 additions & 5 deletions hooks/contact_urns_changed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,29 @@ func TestAddContactURN(t *testing.T) {
models.GeorgeID: []flows.Action{},
},
SQLAssertions: []SQLAssertion{
SQLAssertion{
{
SQL: "select count(*) from contacts_contacturn where contact_id = $1 and scheme = 'telegram' and path = '11551' and priority = 998",
Args: []interface{}{models.CathyID},
Count: 1,
},
SQLAssertion{
{
SQL: "select count(*) from contacts_contacturn where contact_id = $1 and scheme = 'tel' and path = '+12065551212' and priority = 999 and identity = 'tel:+12065551212'",
Args: []interface{}{models.CathyID},
Count: 1,
},
SQLAssertion{
{
SQL: "select count(*) from contacts_contacturn where contact_id = $1 and scheme = 'tel' and path = '+16055741111' and priority = 1000",
Args: []interface{}{models.CathyID},
Count: 1,
},
// evan lost his 206 URN
SQLAssertion{
{
SQL: "select count(*) from contacts_contacturn where contact_id = $1",
Args: []interface{}{models.GeorgeID},
Count: 1,
},
// two contacts updated, both cathy and evan since their URNs changed
SQLAssertion{
{
SQL: "select count(*) from contacts_contact where modified_on > $1",
Args: []interface{}{now},
Count: 2,
Expand Down
6 changes: 3 additions & 3 deletions hooks/input_labels_added_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ func TestInputLabelsAdded(t *testing.T) {
models.BobID: msg2,
},
SQLAssertions: []SQLAssertion{
SQLAssertion{
{
SQL: "select count(*) from msgs_msg_labels WHERE msg_id = $1",
Args: []interface{}{msg1.ID()},
Count: 2,
},
SQLAssertion{
{
SQL: "select count(*) from msgs_msg_labels WHERE msg_id = $1",
Args: []interface{}{msg2.ID()},
Count: 0,
},
SQLAssertion{
{
SQL: "select count(*) from msgs_msg_labels l JOIN msgs_msg m ON l.msg_id = m.id WHERE m.contact_id = $1",
Args: []interface{}{models.BobID},
Count: 0,
Expand Down
8 changes: 4 additions & 4 deletions hooks/msg_created_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,22 @@ func TestMsgCreated(t *testing.T) {
models.CathyID: msg1,
},
SQLAssertions: []SQLAssertion{
SQLAssertion{
{
SQL: "SELECT COUNT(*) FROM msgs_msg WHERE text='Hello World' AND contact_id = $1 AND metadata = $2 AND response_to_id = $3 AND high_priority = TRUE",
Args: []interface{}{models.CathyID, `{"quick_replies":["yes","no"]}`, msg1.ID()},
Count: 2,
},
SQLAssertion{
{
SQL: "SELECT COUNT(*) FROM msgs_msg WHERE text='Hello Attachments' AND contact_id = $1 AND attachments[1] = $2 AND status = 'Q' AND high_priority = FALSE",
Args: []interface{}{models.GeorgeID, "image/png:https://foo.bar.com/images/image1.png"},
Count: 1,
},
SQLAssertion{
{
SQL: "SELECT COUNT(*) FROM msgs_msg WHERE contact_id=$1;",
Args: []interface{}{models.BobID},
Count: 0,
},
SQLAssertion{
{
SQL: "SELECT COUNT(*) FROM msgs_msg WHERE contact_id = $1 AND text = $2 AND metadata = $3 AND direction = 'O' AND status = 'Q' AND channel_id = $4",
Args: []interface{}{
models.AlexandriaID,
Expand Down
8 changes: 4 additions & 4 deletions hooks/session_triggered_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,22 @@ func TestSessionTriggered(t *testing.T) {
},
},
SQLAssertions: []SQLAssertion{
SQLAssertion{
{
SQL: "select count(*) from flows_flowrun where contact_id = $1 AND is_active = FALSE",
Args: []interface{}{models.CathyID},
Count: 1,
},
SQLAssertion{
{
SQL: "select count(*) from flows_flowstart where org_id = 1 AND start_type = 'F' AND flow_id = $1 AND status = 'P' AND parent_summary IS NOT NULL;",
Args: []interface{}{models.SingleMessageFlowID},
Count: 1,
},
SQLAssertion{
{
SQL: "select count(*) from flows_flowstart_contacts where id = 1 AND contact_id = $1",
Args: []interface{}{models.GeorgeID},
Count: 1,
},
SQLAssertion{
{
SQL: "select count(*) from flows_flowstart_groups where id = 1 AND contactgroup_id = $1",
Args: []interface{}{models.TestersGroupID},
Count: 1,
Expand Down
Loading

0 comments on commit 3ec5c42

Please sign in to comment.