diff --git a/acceptance/features/role-crds.feature b/acceptance/features/role-crds.feature index 9ac39d304..7bcd3a5e3 100644 --- a/acceptance/features/role-crds.feature +++ b/acceptance/features/role-crds.feature @@ -31,7 +31,7 @@ Feature: Role CRDs """ And role "admin-role" is successfully synced Then role "admin-role" should exist in cluster "roles" - And role "admin-role" should have members "alice" and "bob" in cluster "roles" + And role "admin-role" should have members "alice and bob" in cluster "roles" @skip:gke @skip:aks @skip:eks Scenario: Manage roles with authorization @@ -39,7 +39,8 @@ Feature: Role CRDs And there are the following pre-existing users in cluster "roles" | name | password | mechanism | | charlie | password | SCRAM-SHA-256 | - When I apply Kubernetes manifest: + When I create topic "public-test" in cluster "roles" + And I apply Kubernetes manifest: """ # tag::manage-roles-with-authorization[] # In this example manifest, a role called "read-only-role" is created in a cluster called "roles". @@ -68,7 +69,7 @@ Feature: Role CRDs And role "read-only-role" is successfully synced Then role "read-only-role" should exist in cluster "roles" And role "read-only-role" should have ACLs for topic pattern "public-" in cluster "roles" - And user "charlie" should be able to read from topic "public-test" in cluster "roles" + And "charlie" should be able to read from topic "public-test" in cluster "roles" @skip:gke @skip:aks @skip:eks Scenario: Manage authorization-only roles diff --git a/acceptance/main_test.go b/acceptance/main_test.go index 7e60106fc..ab370f581 100644 --- a/acceptance/main_test.go +++ b/acceptance/main_test.go @@ -44,6 +44,7 @@ func getSuite(t *testing.T) *framework.Suite { var setupSuite = sync.OnceValues(func() (*framework.Suite, error) { return framework.SuiteBuilderFromFlags(). + Strict(). RegisterProvider("eks", framework.NoopProvider). RegisterProvider("gke", framework.NoopProvider). RegisterProvider("aks", framework.NoopProvider). diff --git a/acceptance/steps/helpers.go b/acceptance/steps/helpers.go index 00e4f9dd5..6ffe7362c 100644 --- a/acceptance/steps/helpers.go +++ b/acceptance/steps/helpers.go @@ -206,6 +206,17 @@ func (c *clusterClients) checkSchema(ctx context.Context, schema string, exists } } +func (c *clusterClients) CreateTopic(ctx context.Context, topic string) { + t := framework.T(ctx) + + admin := kadm.NewClient(c.Kafka(ctx)) + defer admin.Close() + + response, err := admin.CreateTopic(ctx, 1, 1, map[string]*string{}, topic) + require.NoError(t, err) + require.NoError(t, response.Err) +} + func (c *clusterClients) ExpectTopic(ctx context.Context, topic string) { t := framework.T(ctx) diff --git a/acceptance/steps/register.go b/acceptance/steps/register.go index ee287cbf6..1260d3911 100644 --- a/acceptance/steps/register.go +++ b/acceptance/steps/register.go @@ -29,6 +29,7 @@ func init() { framework.RegisterStep(`^there is no topic "([^"]*)" in cluster "([^"]*)"$`, thereIsNoTopic) framework.RegisterStep(`^topic "([^"]*)" is successfully synced$`, topicIsSuccessfullySynced) framework.RegisterStep(`^I should be able to produce and consume from "([^"]*)" in cluster "([^"]*)"$`, iShouldBeAbleToProduceAndConsumeFrom) + framework.RegisterStep(`I create topic "([^"]*)" in cluster "([^"]*)"`, iCreateTopicInCluster) // User scenario steps framework.RegisterStep(`^user "([^"]*)" is successfully synced$`, userIsSuccessfullySynced) diff --git a/acceptance/steps/topics.go b/acceptance/steps/topics.go index a768c27bb..de071089a 100644 --- a/acceptance/steps/topics.go +++ b/acceptance/steps/topics.go @@ -39,6 +39,10 @@ func thereIsNoTopic(ctx context.Context, topic, cluster string) { clientsForCluster(ctx, cluster).ExpectNoTopic(ctx, topic) } +func iCreateTopicInCluster(ctx context.Context, topic, cluster string) { + clientsForCluster(ctx, cluster).CreateTopic(ctx, topic) +} + func iShouldBeAbleToProduceAndConsumeFrom(ctx context.Context, t framework.TestingT, topic, cluster string) { payload := []byte("test") diff --git a/go.work.sum b/go.work.sum index 4443304ae..ce175a10a 100644 --- a/go.work.sum +++ b/go.work.sum @@ -612,7 +612,6 @@ dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/AdaLogics/go-fuzz-headers v0.0.0-20210715213245-6c3934b029d8/go.mod h1:CzsSbkDixRphAF5hS6wbMKq0eI6ccJRb7/A0M6JBnwg= github.com/AdaLogics/go-fuzz-headers v0.0.0-20221103172237-443f56ff4ba8/go.mod h1:i9fr2JpcEcY/IHEvzCM3qXUZYOQHgR89dt4es1CgMhc= -github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0 h1:59MxjQVfjXsBpLy+dbd2/ELV5ofnUkUZBvWSC85sheA= github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0/go.mod h1:OahwfttHWG6eJ0clwcfBAHoDI6X/LV/15hx/wlMZSrU= github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= @@ -1769,11 +1768,11 @@ github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b/go.mod h1:pzzDgJWZ34 github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= -github.com/moby/sys/atomicwriter v0.1.0/go.mod h1:Ul8oqv2ZMNHOceF643P6FKPXeCmYtlQMvpizfsSoaWs= +github.com/moby/sys/mount v0.3.4/go.mod h1:KcQJMbQdJHPlq5lcYT+/CjatWM4PuxKe+XLSVS4J6Os= github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU= -github.com/moby/sys/mountinfo v0.7.2/go.mod h1:1YOa8w8Ih7uW0wALDUgT1dTTSBrZ+HiBLGws92L2RU4= +github.com/moby/sys/reexec v0.1.0/go.mod h1:EqjBg8F3X7iZe5pU6nRZnYCMUTXoxsjiIfHup5wYIN8= github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= github.com/moby/sys/signal v0.6.0/go.mod h1:GQ6ObYZfqacOwTtlXvcmh9A26dVRul/hbOZn88Kg8Tg= github.com/moby/sys/signal v0.7.0 h1:25RW3d5TnQEoKvRbEKUGay6DCQ46IxAVTT9CUMgmsSI= @@ -3153,7 +3152,6 @@ gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= -gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA= helm.sh/helm/v3 v3.14.4/go.mod h1:Tje7LL4gprZpuBNTbG34d1Xn5NmRT3OWfBRwpOSer9I= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/harpoon/suite.go b/harpoon/suite.go index 3bf03c7c9..35ef94ce0 100644 --- a/harpoon/suite.go +++ b/harpoon/suite.go @@ -189,6 +189,11 @@ func (b *SuiteBuilder) WithCRDDirectory(directory string) *SuiteBuilder { return b } +func (b *SuiteBuilder) Strict() *SuiteBuilder { + b.opts.Strict = true + return b +} + func setupErrorCheck(ctx context.Context, err error, cleanupFn func(ctx context.Context)) { if err != nil { fmt.Printf("setting up test suite: %v\n", err)