@@ -8612,7 +8612,8 @@ func Test_Sync_Partials(t *testing.T) {
86128612
86138613func Test_Sync_Consumers_Default_Lookup_Tag (t * testing.T ) {
86148614 runWhenEnterpriseOrKonnect (t , ">=2.8.0" )
8615-
8615+ client , err := getTestClient ()
8616+ require .NoError (t , err )
86168617 ctx := context .Background ()
86178618
86188619 t .Run ("no errors occur in case of subsequent syncs with distributed config and defaultLookupTags for consumer-group" ,
@@ -8650,6 +8651,47 @@ func Test_Sync_Consumers_Default_Lookup_Tag(t *testing.T) {
86508651 err = sync (ctx , "testdata/sync/015-consumer-groups/kong-consumers-no-tag.yaml" )
86518652 require .NoError (t , err )
86528653 })
8654+ t .Run ("no errors occur in case of distributed config when >1 consumers are tagged with different tags" ,
8655+ func (t * testing.T ) {
8656+ // sync consumer-group file first
8657+ err := sync (ctx , "testdata/sync/015-consumer-groups/kong-cg.yaml" )
8658+ t .Cleanup (func () {
8659+ reset (t )
8660+ })
8661+ require .NoError (t , err )
8662+
8663+ // sync consumer file 1
8664+ err = sync (ctx , "testdata/sync/015-consumer-groups/kong-consumer-1.yaml" )
8665+ require .NoError (t , err )
8666+
8667+ // sync consumer file 2
8668+ err = sync (ctx , "testdata/sync/015-consumer-groups/kong-consumer-2.yaml" )
8669+ require .NoError (t , err )
8670+
8671+ // re-sync with no error
8672+ err = sync (ctx , "testdata/sync/015-consumer-groups/kong-consumer-1.yaml" )
8673+ require .NoError (t , err )
8674+ err = sync (ctx , "testdata/sync/015-consumer-groups/kong-consumer-2.yaml" )
8675+ require .NoError (t , err )
8676+
8677+ // check number of consumerGroupConsumers
8678+ currentState , err := fetchCurrentState (ctx , client , deckDump.Config {
8679+ LookUpSelectorTagsConsumerGroups : []string {"group-tag" },
8680+ }, t )
8681+ require .NoError (t , err )
8682+
8683+ consumerGroupConsumers , err := currentState .ConsumerGroupConsumers .GetAll ()
8684+ require .NoError (t , err )
8685+ require .NotNil (t , consumerGroupConsumers )
8686+ require .Len (t , consumerGroupConsumers , 2 )
8687+
8688+ consumerNames := []string {"user1" , "user2" }
8689+
8690+ for _ , consumerGroupConsumer := range consumerGroupConsumers {
8691+ assert .Contains (t , consumerNames , * consumerGroupConsumer .Consumer .Username )
8692+ assert .Equal (t , "foo-group" , * consumerGroupConsumer .ConsumerGroup .Name )
8693+ }
8694+ })
86538695}
86548696
86558697// test scope:
0 commit comments