@@ -2,13 +2,11 @@ package firebase_test
22
33import (
44 "context"
5- "os"
65 "path/filepath"
76 "testing"
87 "time"
98
109 "cloud.google.com/go/firestore"
11- "github.com/stretchr/testify/assert"
1210 "github.com/stretchr/testify/require"
1311
1412 "github.com/testcontainers/testcontainers-go"
@@ -25,27 +23,30 @@ func TestFirebase(t *testing.T) {
2523 testcontainers .CleanupContainer (t , ctr )
2624 require .NoError (t , err )
2725
28- // perform assertions
26+ // perform requireions
2927 // Ports are linked to the example config in firebase/firebase.json
3028
3129 firestoreUrl , err := ctr .ConnectionString (ctx , "8080/tcp" )
32- assert .NoError (t , err )
33- assert .NotEmpty (t , firestoreUrl )
34- _ = os .Setenv ("FIRESTORE_EMULATOR_HOST" , firestoreUrl )
30+ require .NoError (t , err )
31+ require .NotEmpty (t , firestoreUrl )
32+
33+ t .Setenv ("FIRESTORE_EMULATOR_HOST" , firestoreUrl )
3534 c , err := firestore .NewClient (ctx , firestore .DetectProjectID )
3635 require .NoError (t , err )
3736 defer c .Close ()
38- w , err := c .Collection ("example" ).Doc ("one" ).Set (ctx , map [string ]interface {}{
37+
38+ w , err := c .Collection ("example" ).Doc ("one" ).Set (ctx , map [string ]any {
3939 "foo" : "bar" ,
4040 })
41- require .NotNil (t , w )
4241 require .NoError (t , err )
42+ require .NotNil (t , w )
43+
4344 snap , err := c .Collection ("example" ).Doc ("one" ).Get (ctx )
4445 require .NoError (t , err )
4546 var out map [string ]string
4647 err = snap .DataTo (& out )
4748 require .NoError (t , err )
48- assert .Equal (t , "bar" , out ["foo" ])
49+ require .Equal (t , "bar" , out ["foo" ])
4950}
5051
5152func TestFirebaseBadDirectory (t * testing.T ) {
@@ -57,7 +58,7 @@ func TestFirebaseBadDirectory(t *testing.T) {
5758 )
5859 // In this case, the file gets copied over at /srv/failure (instead of /srv/firebase)
5960 // and this stops working.
60- // What would be a solution here? Previously I just added an assertion that the root must
61+ // What would be a solution here? Previously I just added an requireion that the root must
6162 // end in "/firebase"... I could do the same.
6263 testcontainers .CleanupContainer (t , ctr )
6364 require .NoError (t , err )
@@ -69,6 +70,5 @@ func TestFirebaseRequiresRoot(t *testing.T) {
6970
7071 ctr , err := firebase .Run (ctx , "ghcr.io/u-health/docker-firebase-emulator:13.29.2" )
7172 testcontainers .CleanupContainer (t , ctr )
72- require .Error (t , err )
7373 require .ErrorContains (t , err , "unable to boot without configuration root" )
7474}
0 commit comments