99 dynamodbapp "github.com/michasdev/mildstack/core/internal/resources/dynamodb/application"
1010 dynamodbdomain "github.com/michasdev/mildstack/core/internal/resources/dynamodb/domain"
1111 s3domain "github.com/michasdev/mildstack/core/internal/resources/s3/domain"
12+ sqsdomain "github.com/michasdev/mildstack/core/internal/resources/sqs/domain"
1213)
1314
1415type stateHookStub struct {
@@ -36,19 +37,24 @@ func TestDefaultRootIncludesS3AndDynamoDBWithDeterministicRoutes(t *testing.T) {
3637 InstanceID : "test-instance" ,
3738 S3StorageBaseDir : baseDir ,
3839 DynamoDBStorageBaseDir : baseDir ,
40+ SQSStorageBaseDir : baseDir ,
3941 })
40- if got , want := len (root .Services ), 2 ; got != want {
42+ if got , want := len (root .Services ), 3 ; got != want {
4143 t .Fatalf ("unexpected service count: got %d want %d" , got , want )
4244 }
4345
4446 first := root .Services [0 ]
4547 second := root .Services [1 ]
48+ third := root .Services [2 ]
4649 if got , want := first .Metadata ().Name , "s3" ; got != want {
4750 t .Fatalf ("unexpected first service name: got %q want %q" , got , want )
4851 }
4952 if got , want := second .Metadata ().Name , "dynamodb" ; got != want {
5053 t .Fatalf ("unexpected second service name: got %q want %q" , got , want )
5154 }
55+ if got , want := third .Metadata ().Name , "sqs" ; got != want {
56+ t .Fatalf ("unexpected third service name: got %q want %q" , got , want )
57+ }
5258
5359 registrar := deliveryhttp .NewRegistrar ()
5460 for _ , service := range root .Services {
@@ -58,7 +64,7 @@ func TestDefaultRootIncludesS3AndDynamoDBWithDeterministicRoutes(t *testing.T) {
5864 }
5965
6066 entries := registrar .Services ()
61- if got , want := len (entries ), 2 ; got != want {
67+ if got , want := len (entries ), 3 ; got != want {
6268 t .Fatalf ("unexpected catalog size: got %d want %d" , got , want )
6369 }
6470 if got , want := entries [0 ].Name , "dynamodb" ; got != want {
@@ -67,6 +73,9 @@ func TestDefaultRootIncludesS3AndDynamoDBWithDeterministicRoutes(t *testing.T) {
6773 if got , want := entries [1 ].Name , "s3" ; got != want {
6874 t .Fatalf ("unexpected second catalog service: got %q want %q" , got , want )
6975 }
76+ if got , want := entries [2 ].Name , "sqs" ; got != want {
77+ t .Fatalf ("unexpected third catalog service: got %q want %q" , got , want )
78+ }
7079
7180 s3Entry , ok := registrar .Service ("s3" )
7281 if ! ok {
@@ -125,6 +134,9 @@ func TestDefaultRootIncludesS3AndDynamoDBWithDeterministicRoutes(t *testing.T) {
125134 if _ , ok := root .Services [1 ].(deliveryhttp.DynamoDBNativeService ); ! ok {
126135 t .Fatal ("expected dynamodb service to expose the native http surface" )
127136 }
137+ if _ , ok := root .Services [2 ].(deliveryhttp.SQSNativeService ); ! ok {
138+ t .Fatal ("expected sqs service to expose the native http surface" )
139+ }
128140
129141 if value , ok := hook .Get (dynamodbdomain .StateKey ); ! ok {
130142 t .Fatalf ("expected state for %q to be present" , dynamodbdomain .StateKey )
@@ -144,6 +156,18 @@ func TestDefaultRootIncludesS3AndDynamoDBWithDeterministicRoutes(t *testing.T) {
144156 t .Fatalf ("unexpected s3 state: got %v want %v" , got , want )
145157 }
146158
159+ if value , ok := hook .Get (sqsdomain .StateKey ); ! ok {
160+ t .Fatalf ("expected state for %q to be present" , sqsdomain .StateKey )
161+ } else {
162+ state := value .(map [string ]any )
163+ if got , want := state ["service" ], "sqs" ; got != want {
164+ t .Fatalf ("unexpected sqs state: got %v want %v" , got , want )
165+ }
166+ if got , want := len (state ["queues" ].([]any )), 0 ; got != want {
167+ t .Fatalf ("unexpected sqs queue count: got %d want %d" , got , want )
168+ }
169+ }
170+
147171 dynamoDBPath := filepath .Join (baseDir , "instances" , "test-instance" , "dynamodb" , "state.db" )
148172 if _ , err := os .Stat (dynamoDBPath ); err != nil {
149173 t .Fatalf ("expected dynamodb database to exist at %s: %v" , dynamoDBPath , err )
@@ -186,8 +210,9 @@ func TestDefaultRootUsesInstanceScopedDynamoDBStorage(t *testing.T) {
186210 InstanceID : "instance-a" ,
187211 S3StorageBaseDir : baseDir ,
188212 DynamoDBStorageBaseDir : baseDir ,
213+ SQSStorageBaseDir : baseDir ,
189214 })
190- if got , want := len (root .Services ), 2 ; got != want {
215+ if got , want := len (root .Services ), 3 ; got != want {
191216 t .Fatalf ("unexpected service count: got %d want %d" , got , want )
192217 }
193218
0 commit comments