Skip to content

Commit

Permalink
more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
GGabriele committed Aug 2, 2023
1 parent f7222bc commit cd55b4f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
5 changes: 1 addition & 4 deletions file/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -974,10 +974,7 @@ func (b *stateBuilder) validatePlugin(p FPlugin) error {
}
_, enforceConsumerGroupsFound := p.Config["enforce_consumer_groups"]
if consumerGroupsFound || enforceConsumerGroupsFound {
return errors.New("a rate-limiting-advanced plugin with config.consumer_groups\n" +
"and/or config.enforce_consumer_groups was found. Please use Consumer Groups scoped\n" +
"Plugins when running against Kong Enterprise 3.4.0 and above.\n\n" +
"Check DOC_LINK for more information")
return utils.ErrorConsumerGroupUpgrade
}
}
return nil
Expand Down
11 changes: 4 additions & 7 deletions tests/integration/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"crypto/tls"
"crypto/x509"
"errors"
"fmt"
"net/http"
"testing"
"time"
Expand Down Expand Up @@ -4521,13 +4522,9 @@ func Test_Sync_ConsumerGroupsScopedPlugins_Post340(t *testing.T) {
expectedError error
}{
{
name: "attempt to createe consumer groups scoped plugins with older Kong version",
kongFile: "testdata/sync/017-consumer-groups-rla-application/kong3x.yaml",
expectedError: errors.New(
"building state: a rate-limiting-advanced plugin with config.consumer_groups\n" +
"and/or config.enforce_consumer_groups was found. Please use Consumer Groups scoped\n" +
"Plugins when running against Kong Enterprise 3.4.0 and above.\n\n" +
"Check DOC_LINK for more information"),
name: "attempt to createe consumer groups scoped plugins with older Kong version",
kongFile: "testdata/sync/017-consumer-groups-rla-application/kong3x.yaml",
expectedError: fmt.Errorf("building state: %v", utils.ErrorConsumerGroupUpgrade),
},
}
for _, tc := range tests {
Expand Down
8 changes: 8 additions & 0 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package utils

import (
"context"
"errors"
"fmt"
"net/url"
"os"
Expand All @@ -24,6 +25,13 @@ var (
Kong340Version = semver.MustParse("3.4.0")
)

var ErrorConsumerGroupUpgrade = errors.New(
"a rate-limiting-advanced plugin with config.consumer_groups\n" +
"and/or config.enforce_consumer_groups was found. Please use Consumer Groups scoped\n" +
"Plugins when running against Kong Enterprise 3.4.0 and above.\n\n" +
"Check DOC_LINK for more information",
)

var UpgradeMessage = "Please upgrade your configuration to account for 3.0\n" +
"breaking changes using the following command:\n\n" +
"deck convert --from kong-gateway-2.x --to kong-gateway-3.x\n\n" +
Expand Down

0 comments on commit cd55b4f

Please sign in to comment.