Skip to content

Commit

Permalink
chore: simplify how to compare tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelapenya committed Nov 3, 2022
1 parent 9eba684 commit 70e2ed5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions examples/cockroachdb/cockroachdb_test.go
Expand Up @@ -6,8 +6,8 @@ import (
"testing"
"time"

"github.com/google/go-cmp/cmp"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
)

// Task represents a unit of work to complete. We're going to be using this in
Expand Down Expand Up @@ -95,7 +95,9 @@ func TestIntegrationDBInsertSelect(t *testing.T) {
t.Fatal(err)
}

if !cmp.Equal(tsk, savedTsk) {
t.Fatalf("Saved task is not the same:\n%s", cmp.Diff(tsk, savedTsk))
}
assert.Equal(t, tsk.ID, savedTsk.ID)
assert.Equal(t, tsk.Description, savedTsk.Description)
assert.Equal(t, tsk.DateDue, savedTsk.DateDue)
assert.Equal(t, tsk.DateCreated.Local().String(), savedTsk.DateCreated.Local().String())
assert.Equal(t, tsk.DateUpdated.Local().String(), savedTsk.DateUpdated.Local().String())
}
4 changes: 2 additions & 2 deletions examples/cockroachdb/go.mod
Expand Up @@ -3,9 +3,9 @@ module github.com/testcontainers/testcontainers-go/examples/cockroachdb
go 1.18

require (
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.3.0
github.com/jackc/pgx/v4 v4.17.2
github.com/stretchr/testify v1.8.0
github.com/testcontainers/testcontainers-go v0.15.0
gotest.tools/gotestsum v1.8.2
)
Expand Down Expand Up @@ -66,6 +66,7 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
Expand Down Expand Up @@ -123,7 +124,6 @@ require (
github.com/spf13/cobra v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.4.0 // indirect
github.com/stretchr/testify v1.8.0 // indirect
github.com/theupdateframework/notary v0.7.0 // indirect
github.com/tonistiigi/fsutil v0.0.0-20220930225714-4638ad635be5 // indirect
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect
Expand Down

0 comments on commit 70e2ed5

Please sign in to comment.