Skip to content

Commit

Permalink
backend: initial move of services into versioned structure
Browse files Browse the repository at this point in the history
  • Loading branch information
bojand committed Jul 4, 2024
1 parent bf0ee6d commit 027c236
Show file tree
Hide file tree
Showing 31 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
v1alpha1connect "github.com/redpanda-data/console/backend/pkg/protogen/redpanda/api/dataplane/v1alpha1/dataplanev1alpha1connect"
)

func (s *APISuite) DeleteAllACLs(ctx context.Context) error {
func (s *APISuite) DeleteAllACLs_V1Alpha1(ctx context.Context) error {
acls := kadm.NewACLs().
Allow().
ResourcePatternType(kadm.ACLPatternAny).
Expand All @@ -48,7 +48,7 @@ func (s *APISuite) DeleteAllACLs(ctx context.Context) error {
}

//nolint:unparam // Principal always receives "User:test" as of now, but good to keep for clarity
func (*APISuite) newStdACLResource(resourceType v1alpha1.ACL_ResourceType, resourceName string, principal string) *v1alpha1.ListACLsResponse_Resource {
func (*APISuite) newStdACLResource_V1Alpha1(resourceType v1alpha1.ACL_ResourceType, resourceName string, principal string) *v1alpha1.ListACLsResponse_Resource {
return &v1alpha1.ListACLsResponse_Resource{
ResourceType: resourceType,
ResourceName: resourceName,
Expand All @@ -64,7 +64,7 @@ func (*APISuite) newStdACLResource(resourceType v1alpha1.ACL_ResourceType, resou
}
}

func (s *APISuite) TestCreateACL() {
func (s *APISuite) TestCreateACL_V1Alpha1() {
t := s.T()

t.Run("create ACL with default request (connect-go)", func(t *testing.T) {
Expand All @@ -91,7 +91,7 @@ func (s *APISuite) TestCreateACL() {
defer func() {
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
err := s.DeleteAllACLs(ctx)
err := s.DeleteAllACLs_V1Alpha1(ctx)
assert.NoError(err, "failed to delete all ACLs")
}()

Expand Down Expand Up @@ -159,7 +159,7 @@ func (s *APISuite) TestCreateACL() {
defer func() {
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
err := s.DeleteAllACLs(ctx)
err := s.DeleteAllACLs_V1Alpha1(ctx)
assert.NoError(err, "failed to delete all ACLs")
}()

Expand Down Expand Up @@ -235,13 +235,13 @@ func (s *APISuite) TestCreateACL() {
defer func() {
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
err := s.DeleteAllACLs(ctx)
err := s.DeleteAllACLs_V1Alpha1(ctx)
assert.NoError(err, "failed to delete all ACLs")
}()
})
}

func (s *APISuite) TestListACLs() {
func (s *APISuite) TestListACLs_V1Alpha1() {
t := s.T()

t.Run("list ACLs with default request (connect-go)", func(t *testing.T) {
Expand Down Expand Up @@ -280,7 +280,7 @@ func (s *APISuite) TestListACLs() {
defer func() {
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
err := s.DeleteAllACLs(ctx)
err := s.DeleteAllACLs_V1Alpha1(ctx)
assert.NoError(err, "failed to delete all ACLs")
}()

Expand Down Expand Up @@ -314,10 +314,10 @@ func (s *APISuite) TestListACLs() {

// 4. Compare all filtered resources against expected ACLs
expectedResources := map[v1alpha1.ACL_ResourceType]*v1alpha1.ListACLsResponse_Resource{
v1alpha1.ACL_RESOURCE_TYPE_TOPIC: s.newStdACLResource(v1alpha1.ACL_RESOURCE_TYPE_TOPIC, resourceNames[v1alpha1.ACL_RESOURCE_TYPE_TOPIC], principal),
v1alpha1.ACL_RESOURCE_TYPE_TRANSACTIONAL_ID: s.newStdACLResource(v1alpha1.ACL_RESOURCE_TYPE_TRANSACTIONAL_ID, resourceNames[v1alpha1.ACL_RESOURCE_TYPE_TRANSACTIONAL_ID], principal),
v1alpha1.ACL_RESOURCE_TYPE_GROUP: s.newStdACLResource(v1alpha1.ACL_RESOURCE_TYPE_GROUP, resourceNames[v1alpha1.ACL_RESOURCE_TYPE_GROUP], principal),
v1alpha1.ACL_RESOURCE_TYPE_CLUSTER: s.newStdACLResource(v1alpha1.ACL_RESOURCE_TYPE_CLUSTER, resourceNames[v1alpha1.ACL_RESOURCE_TYPE_CLUSTER], principal),
v1alpha1.ACL_RESOURCE_TYPE_TOPIC: s.newStdACLResource_V1Alpha1(v1alpha1.ACL_RESOURCE_TYPE_TOPIC, resourceNames[v1alpha1.ACL_RESOURCE_TYPE_TOPIC], principal),
v1alpha1.ACL_RESOURCE_TYPE_TRANSACTIONAL_ID: s.newStdACLResource_V1Alpha1(v1alpha1.ACL_RESOURCE_TYPE_TRANSACTIONAL_ID, resourceNames[v1alpha1.ACL_RESOURCE_TYPE_TRANSACTIONAL_ID], principal),
v1alpha1.ACL_RESOURCE_TYPE_GROUP: s.newStdACLResource_V1Alpha1(v1alpha1.ACL_RESOURCE_TYPE_GROUP, resourceNames[v1alpha1.ACL_RESOURCE_TYPE_GROUP], principal),
v1alpha1.ACL_RESOURCE_TYPE_CLUSTER: s.newStdACLResource_V1Alpha1(v1alpha1.ACL_RESOURCE_TYPE_CLUSTER, resourceNames[v1alpha1.ACL_RESOURCE_TYPE_CLUSTER], principal),
}
assert.Len(filteredResources, len(expectedResources))

Expand Down Expand Up @@ -383,7 +383,7 @@ func (s *APISuite) TestListACLs() {
defer func() {
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
err := s.DeleteAllACLs(ctx)
err := s.DeleteAllACLs_V1Alpha1(ctx)
assert.NoError(err, "failed to delete all ACLs")
}()

Expand Down Expand Up @@ -418,7 +418,7 @@ func (s *APISuite) TestListACLs() {
})
}

func (s *APISuite) TestDeleteACLs() {
func (s *APISuite) TestDeleteACLs_V1Alpha1() {
t := s.T()

t.Run("delete ACLs with a filter that matches all three created ACLs (connect-go)", func(t *testing.T) {
Expand Down Expand Up @@ -455,7 +455,7 @@ func (s *APISuite) TestDeleteACLs() {
defer func() {
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
err := s.DeleteAllACLs(ctx)
err := s.DeleteAllACLs_V1Alpha1(ctx)
assert.NoError(err, "failed to delete all ACLs")
}()

Expand Down Expand Up @@ -531,7 +531,7 @@ func (s *APISuite) TestDeleteACLs() {
defer func() {
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
err := s.DeleteAllACLs(ctx)
err := s.DeleteAllACLs_V1Alpha1(ctx)
assert.NoError(err, "failed to delete all ACLs")
}()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/redpanda-data/console/backend/pkg/testutil"
)

func (s *APISuite) TestListConnectors() {
func (s *APISuite) TestListConnectors_V1Alpha1() {
t := s.T()

t.Run("list Connectors with invalid Request (connect-go)", func(t *testing.T) {
Expand Down Expand Up @@ -64,7 +64,7 @@ func (s *APISuite) TestListConnectors() {
})
}

func (s *APISuite) TestListConnectClusters() {
func (s *APISuite) TestListConnectClusters_V1Alpha1() {
t := s.T()

t.Run("list connect clusters request (connect-go)", func(t *testing.T) {
Expand Down Expand Up @@ -123,7 +123,7 @@ func (s *APISuite) TestListConnectClusters() {
})
}

func (s *APISuite) TestGetConnectorAndStatus() {
func (s *APISuite) TestGetConnectorAndStatus_V1Alpha1() {
t := s.T()
requireT := require.New(t)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
v1alpha1connect "github.com/redpanda-data/console/backend/pkg/protogen/redpanda/api/dataplane/v1alpha1/dataplanev1alpha1connect"
)

func (s *APISuite) TestListTopics() {
func (s *APISuite) TestListTopics_V1Alpha1() {
t := s.T()

// Seed some topics that can be listed
Expand Down Expand Up @@ -197,7 +197,7 @@ func (s *APISuite) TestListTopics() {
})
}

func (s *APISuite) TestCreateTopic() {
func (s *APISuite) TestCreateTopic_V1Alpha1() {
t := s.T()

t.Run("create topic with valid request (connect-go)", func(t *testing.T) {
Expand Down Expand Up @@ -485,7 +485,7 @@ func (s *APISuite) TestCreateTopic() {
})
}

func (s *APISuite) TestDeleteTopic() {
func (s *APISuite) TestDeleteTopic_V1Alpha1() {
t := s.T()

t.Run("delete topic with valid request (connect-go)", func(t *testing.T) {
Expand Down Expand Up @@ -643,7 +643,7 @@ func (s *APISuite) TestDeleteTopic() {
})
}

func (s *APISuite) TestGetTopicConfiguration() {
func (s *APISuite) TestGetTopicConfiguration_V1Alpha1() {
t := s.T()

t.Run("get topic configuration of a valid topic (connect-go)", func(t *testing.T) {
Expand Down Expand Up @@ -788,7 +788,7 @@ func (s *APISuite) TestGetTopicConfiguration() {
})
}

func (s *APISuite) TestUpdateTopicConfiguration() {
func (s *APISuite) TestUpdateTopicConfiguration_V1Alpha1() {
t := s.T()

t.Run("update topic configuration of a valid topic (connect-go)", func(t *testing.T) {
Expand Down Expand Up @@ -1086,7 +1086,7 @@ func (s *APISuite) TestUpdateTopicConfiguration() {
})
}

func (s *APISuite) TestSetTopicConfiguration() {
func (s *APISuite) TestSetTopicConfiguration_V1Alpha1() {
t := s.T()

t.Run("set topic configuration of a valid topic (connect-go)", func(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import (
var identityTransform []byte

// DirectDeployAndTestTransform encapsulates the logic for creating a transform and asserting its successful creation.
func (s *APISuite) TestDeployTransform() {
func (s *APISuite) TestDeployTransform_V1Alpha1() {
t := s.T()

type KeyVal struct {
Expand Down Expand Up @@ -356,7 +356,7 @@ func (s *APISuite) TestDeployTransform() {
})
}

func (s *APISuite) TestGetTransform() {
func (s *APISuite) TestGetTransform_V1Alpha1() {
t := s.T()

assert := assertpkg.New(t)
Expand Down Expand Up @@ -555,7 +555,7 @@ func (s *APISuite) TestGetTransform() {
})
}

func (s *APISuite) TestListTransforms() {
func (s *APISuite) TestListTransforms_V1Alpha1() {
t := s.T()

require := requirepkg.New(t)
Expand Down Expand Up @@ -682,7 +682,7 @@ func (s *APISuite) TestListTransforms() {
})
}

func (s *APISuite) TestDeleteTransforms() {
func (s *APISuite) TestDeleteTransforms_V1Alpha1() {
t := s.T()

require := requirepkg.New(t)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
v1alpha1connect "github.com/redpanda-data/console/backend/pkg/protogen/redpanda/api/dataplane/v1alpha1/dataplanev1alpha1connect"
)

func (s *APISuite) TestListUsers() {
func (s *APISuite) TestListUsers_V1Alpha1() {
t := s.T()

t.Run("list users with valid request (connect-go)", func(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

"github.com/twmb/franz-go/pkg/kmsg"

"github.com/redpanda-data/console/backend/pkg/api/connect/service/common"
common "github.com/redpanda-data/console/backend/pkg/api/connect/service/common/v1alpha1"
v1alpha1 "github.com/redpanda-data/console/backend/pkg/protogen/redpanda/api/dataplane/v1alpha1"
)

Expand Down
10 changes: 5 additions & 5 deletions backend/pkg/api/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ import (

apierrors "github.com/redpanda-data/console/backend/pkg/api/connect/errors"
"github.com/redpanda-data/console/backend/pkg/api/connect/interceptor"
apiaclsvc "github.com/redpanda-data/console/backend/pkg/api/connect/service/acl"
apiaclsvc "github.com/redpanda-data/console/backend/pkg/api/connect/service/acl/v1alpha1"
consolesvc "github.com/redpanda-data/console/backend/pkg/api/connect/service/console"
apikafkaconnectsvc "github.com/redpanda-data/console/backend/pkg/api/connect/service/kafkaconnect"
apikafkaconnectsvc "github.com/redpanda-data/console/backend/pkg/api/connect/service/kafkaconnect/v1alpha1"
"github.com/redpanda-data/console/backend/pkg/api/connect/service/rpconnect"
topicsvc "github.com/redpanda-data/console/backend/pkg/api/connect/service/topic"
transformsvc "github.com/redpanda-data/console/backend/pkg/api/connect/service/transform"
apiusersvc "github.com/redpanda-data/console/backend/pkg/api/connect/service/user"
topicsvc "github.com/redpanda-data/console/backend/pkg/api/connect/service/topic/v1alpha1"
transformsvc "github.com/redpanda-data/console/backend/pkg/api/connect/service/transform/v1alpha1"
apiusersvc "github.com/redpanda-data/console/backend/pkg/api/connect/service/user/v1alpha1"
"github.com/redpanda-data/console/backend/pkg/protogen/redpanda/api/console/v1alpha1/consolev1alpha1connect"
"github.com/redpanda-data/console/backend/pkg/protogen/redpanda/api/dataplane/v1alpha1/dataplanev1alpha1connect"
"github.com/redpanda-data/console/backend/pkg/version"
Expand Down

0 comments on commit 027c236

Please sign in to comment.