Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add use of subtests #1

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/acceptance-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
id: go
- uses: actions/cache@v2
with:
path: |
Expand All @@ -34,5 +35,9 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: modTidy
run: go mod tidy
- name: modVendor
run: go mod vendor
- name: Run tests
run: make testacc
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ NAME=julieops
BINARY=terraform-provider-${NAME}
VERSION=0.3
OS_ARCH=darwin_amd64
TESTARGS=-p 1
TESTARGS=

default: install

Expand Down
6 changes: 5 additions & 1 deletion julie/resource_kafka_connect_acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import (
"testing"
)

func TestAccKafkaConnectAclCreate(t *testing.T) {
func TestAccKafkaConnectAclsManagement(t *testing.T) {
t.Run("Test Kafka Connect ACLs create", testAccKafkaConnectAclCreate)
}

func testAccKafkaConnectAclCreate(t *testing.T) {
ctx := context.Background()
setup, close := julieTest.SetupDocker(ctx, julieTest.ContainersSetupConfig{}, t)
defer close(ctx)
Expand Down
6 changes: 5 additions & 1 deletion julie/resource_kafka_connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import (
"testing"
)

func TestAccKafkaConnectCreate(t *testing.T) {
func TestAccKafkaConnectorManagement(t *testing.T) {
t.Run("Test Kafka Connector create", testAccKafkaConnectCreate)
}

func testAccKafkaConnectCreate(t *testing.T) {
ctx := context.Background()
setup, close := julieTest.SetupDocker(ctx, julieTest.ContainersSetupConfig{
EnableSchemaRegistry: true, EnableKafkaConnect: true,
Expand Down
6 changes: 5 additions & 1 deletion julie/resource_kafka_consumer_acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import (
"testing"
)

func TestAccKafkaAclCreate(t *testing.T) {
func TestAccKafkaAclsManagement(t *testing.T) {
t.Run("Test Kafka Consumers ACLs create", testAccKafkaAclCreate)
}

func testAccKafkaAclCreate(t *testing.T) {
ctx := context.Background()
setup, close := julieTest.SetupDocker(ctx, julieTest.ContainersSetupConfig{}, t)
defer close(ctx)
Expand Down
6 changes: 5 additions & 1 deletion julie/resource_kafka_streams_acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import (
"testing"
)

func TestAccKafkaStreamsAclCreate(t *testing.T) {
func TestAccKafkaStreamsAclsManagement(t *testing.T) {
t.Run("Test Kafka Streams ACLs create", testAccKafkaStreamsAclCreate)
}

func testAccKafkaStreamsAclCreate(t *testing.T) {

ctx := context.Background()
setup, close := julieTest.SetupDocker(ctx, julieTest.ContainersSetupConfig{}, t)
Expand Down
19 changes: 9 additions & 10 deletions julie/resource_kafka_topic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ import (
"testing"
)

func TestAccKafkaTopicCreateWithoutConfig(t *testing.T) {
func TestAccKafkaTopicManagement(t *testing.T) {
t.Run("Test Kafka Topics without Config", testKafkaTopicCreateWithoutConfig)
t.Run("Test Kafka Topics with Config", testKafkaTopicCreateWithConfig)
t.Run("Test Kafka Topics update", testKafkaTopicConfigUpdate)
}

func testKafkaTopicCreateWithoutConfig(t *testing.T) {

ctx := context.Background()
setup, close := julieTest.SetupDocker(ctx, julieTest.ContainersSetupConfig{}, t)
Expand All @@ -35,7 +41,7 @@ func TestAccKafkaTopicCreateWithoutConfig(t *testing.T) {
})
}

func TestAccKafkaTopicCreateWithConfig(t *testing.T) {
func testKafkaTopicCreateWithConfig(t *testing.T) {
ctx := context.Background()
setup, close := julieTest.SetupDocker(ctx, julieTest.ContainersSetupConfig{}, t)
defer close(ctx)
Expand All @@ -59,7 +65,7 @@ func TestAccKafkaTopicCreateWithConfig(t *testing.T) {
})
}

func TestAccKafkaTopicConfigUpdate(t *testing.T) {
func testKafkaTopicConfigUpdate(t *testing.T) {
ctx := context.Background()
setup, close := julieTest.SetupDocker(ctx, julieTest.ContainersSetupConfig{}, t)
defer close(ctx)
Expand Down Expand Up @@ -109,13 +115,6 @@ resource "julieops_kafka_topic" "test_config" {
}
`

/*func cfg(bs string, extraCfg string) string {
var saslConfig = " \t sasl_username = \"kafka\" \n \t sasl_password = \"kafka\" \n \t sasl_mechanism = \"plain\" \n "
var str = "provider \"julieops\" { \n \t bootstrap_servers = \"%s\" \n %s } \n %s \n"
//log.Printf(str, bs, saslConfig, extraCfg)
return fmt.Sprintf(str, bs, saslConfig, extraCfg)
}*/

func cfg(bs string, connect string, extraCfg string) string {
var saslConfig = " \t sasl_username = \"kafka\" \n \t sasl_password = \"kafka\" \n \t sasl_mechanism = \"plain\" \n "
var connectConfig = fmt.Sprintf("\t kafka_connects = \"%s\" \n", connect)
Expand Down
3 changes: 0 additions & 3 deletions julie/test/kafka_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ func SetupKafkaEnv(ctx context.Context, zookeeperUri string, versionTag string,
ExposedPorts: []string{"9092:9092"},
Env: env,
BindMounts: mounts,
Name: "kafka",
Hostname: "kafka",
Networks: []string{
"julie_ops-cli",
Expand Down Expand Up @@ -220,7 +219,6 @@ func SetupSchemaRegistry(ctx context.Context, config DockerContainerConfig) (*sc
Image: "confluentinc/cp-schema-registry:" + config.VersionTag,
ExposedPorts: []string{SchemaRegistryPortString + ":" + SchemaRegistryPortString},
Env: env,
Name: "schema-registry",
Hostname: "schema-registry",
Networks: []string{
"julie_ops-cli",
Expand Down Expand Up @@ -284,7 +282,6 @@ func SetupKafkaConnect(ctx context.Context, config DockerContainerConfig) (*kafk
ExposedPorts: []string{KafkaConnectPortString + ":" + KafkaConnectPortString},
Env: env,
BindMounts: mounts,
Name: "kafka-connect",
Hostname: "kafka-connect",
Networks: []string{
"julie_ops-cli",
Expand Down
1 change: 0 additions & 1 deletion julie/test/zookeeper_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func SetupZookeeperEnv(ctx context.Context, versionTag string, mountPath string)
ExposedPorts: []string{"2181/tcp"},
Env: env,
BindMounts: mounts,
Name: "zookeeper",
Hostname: "zookeeper",
Networks: []string{
"julie_ops-cli",
Expand Down