Skip to content

Commit

Permalink
[redpanda] sasl test for wrong mechanism (#2048)
Browse files Browse the repository at this point in the history
* [redpanda] sasl test, wrong mechanism

- ensure that when using a different sasl mechanism from the broker,
  unsupported error is returned

* chore: use require

---------

Co-authored-by: Manuel de la Peña <[email protected]>
Co-authored-by: Manuel de la Peña <[email protected]>
  • Loading branch information
3 people authored Feb 2, 2024
1 parent 60cf941 commit bdab82e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions modules/redpanda/redpanda_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/twmb/franz-go/pkg/kadm"
"github.com/twmb/franz-go/pkg/kerr"
"github.com/twmb/franz-go/pkg/kgo"
"github.com/twmb/franz-go/pkg/sasl/plain"
"github.com/twmb/franz-go/pkg/sasl/scram"

"github.com/testcontainers/testcontainers-go"
Expand Down Expand Up @@ -162,6 +163,23 @@ func TestRedpandaWithAuthentication(t *testing.T) {
require.ErrorContains(t, err, "SASL_AUTHENTICATION_FAILED")
}

// Test wrong mechanism
{
kafkaCl, err := kgo.NewClient(
kgo.SeedBrokers(seedBroker),
kgo.SASL(plain.Auth{
User: "no-superuser",
Pass: "test",
}.AsMechanism()),
)
require.NoError(t, err)

kafkaAdmCl := kadm.NewClient(kafkaCl)
_, err = kafkaAdmCl.Metadata(ctx)
require.Error(t, err)
require.ErrorContains(t, err, "UNSUPPORTED_SASL_MECHANISM")
}

// Test Schema Registry API
httpCl := &http.Client{Timeout: 5 * time.Second}
// schemaRegistryAddress {
Expand Down

0 comments on commit bdab82e

Please sign in to comment.