This repository was archived by the owner on Aug 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 182
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blukat29
previously approved these changes
May 7, 2024
The official zookeeper image seems working. But there's no official Kafka image. Could you try https://hub.docker.com/r/bitnami/kafka instead? |
JayChoi1736
previously approved these changes
May 7, 2024
9 tasks
@Sotatek-TinnNguyen Found the solution thanks to cadence-workflow/cadence#5975. See diffdiff --git a/.circleci/config.yml b/.circleci/config.yml
index c8aad0d5..f74c875d 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -43,22 +43,20 @@ executors:
auth:
username: $DOCKER_LOGIN
password: $DOCKER_PASSWORD
- - name: zookeeper
- image: wurstmeister/zookeeper
- auth:
- username: $DOCKER_LOGIN
- password: $DOCKER_PASSWORD
- name: kafka
- image: wurstmeister/kafka
+ image: bitnami/kafka:3.7
auth:
username: $DOCKER_LOGIN
password: $DOCKER_PASSWORD
environment:
- KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
- KAFKA_ADVERTISED_LISTENERS: INSIDE://:9092,OUTSIDE://kafka:9094
- KAFKA_LISTENERS: INSIDE://:9092,OUTSIDE://kafka:9094
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
- KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
+ KAFKA_CFG_NODE_ID: 0
+ KAFKA_CFG_PROCESS_ROLES: controller,broker
+ KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 0@kafka:9093
+ KAFKA_CFG_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
+ KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
+ KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
+ KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER
+ KAFKA_CFG_INTER_BROKER_LISTENER_NAME: PLAINTEXT
darwin-executor: # this executor is for packaging darwin binaries
working_directory: ~/go/src/github.com/klaytn/klaytn
macos:
@@ -280,16 +278,6 @@ commands:
sleep 1
done
echo Failed waiting for Redis && exit 1
- - run:
- name: "Waiting for zookeeper to be ready"
- command: |
- for i in `seq 1 10`;
- do
- nc -z zookeeper 2181 && echo Success && exit 0
- echo -n .
- sleep 1
- done
- echo Failed waiting for zookeeper && exit 1
- run:
name: "Waiting for Kafka to be ready"
command: |
diff --git a/datasync/chaindatafetcher/kafka/kafka_test.go b/datasync/chaindatafetcher/kafka/kafka_test.go
index f27611a9..a5cd385f 100644
--- a/datasync/chaindatafetcher/kafka/kafka_test.go
+++ b/datasync/chaindatafetcher/kafka/kafka_test.go
@@ -45,11 +45,11 @@ type KafkaSuite struct {
topic string
}
-// In order to test KafkaSuite, any available kafka broker must be connectable with "kafka:9094".
+// In order to test KafkaSuite, any available kafka broker must be connectable with "kafka:9092".
// If no kafka broker is available, the KafkaSuite tests are skipped.
func (s *KafkaSuite) SetupTest() {
s.conf = GetDefaultKafkaConfig()
- s.conf.Brokers = []string{"kafka:9094"}
+ s.conf.Brokers = []string{"kafka:9092"}
kfk, err := NewKafka(s.conf)
if err == sarama.ErrOutOfBrokers {
s.T().Log("Failed connecting to brokers", s.conf.Brokers)
@@ -159,27 +159,34 @@ func (s *KafkaSuite) TestKafka_setupTopicConcurrency() {
}
func (s *KafkaSuite) TestKafka_CreateAndDeleteTopic() {
+ topicName := "test-create-delete-topic"
+
// no topic to be deleted
- err := s.kfk.DeleteTopic(s.topic)
+ err := s.kfk.DeleteTopic(topicName)
s.Error(err)
s.True(strings.Contains(err.Error(), sarama.ErrUnknownTopicOrPartition.Error()))
// created a topic successfully
- err = s.kfk.CreateTopic(s.topic)
+ err = s.kfk.CreateTopic(topicName)
s.NoError(err)
// failed to create a duplicated topic
- err = s.kfk.CreateTopic(s.topic)
+ err = s.kfk.CreateTopic(topicName)
s.Error(err)
s.True(strings.Contains(err.Error(), sarama.ErrTopicAlreadyExists.Error()))
// deleted a topic successfully
- s.Nil(s.kfk.DeleteTopic(s.topic))
+ s.Nil(s.kfk.DeleteTopic(topicName))
- topics, err := s.kfk.ListTopics()
- if _, exist := topics[s.topic]; exist {
- s.Fail("topic must not exist")
+ for i := 0; i < 10; i++ {
+ topics, err := s.kfk.ListTopics()
+ s.NoError(err)
+ if _, exist := topics[topicName]; !exist {
+ return // success
+ }
+ time.Sleep(time.Second)
}
+ s.Fail("topic must not exist")
}
type kafkaData struct {
@@ -225,7 +232,7 @@ func (s *KafkaSuite) subscribeData(topic, groupId string, numTests int, handler
}()
// wait for all data to be consumed
- timeout := time.NewTimer(5 * time.Second)
+ timeout := time.NewTimer(10 * time.Second)
for i := 0; i < numTests; i++ {
select {
case <-numCheckCh:
@@ -466,7 +473,7 @@ func (s *KafkaSuite) TestKafka_PubSubWithSegements_BufferOverflow() {
}()
// checkout the returned error is buffer overflow error
- timeout := time.NewTimer(3 * time.Second)
+ timeout := time.NewTimer(10 * time.Second)
select {
case <-timeout.C:
s.Fail("timeout")
@@ -501,7 +508,7 @@ func (s *KafkaSuite) TestKafka_PubSubWithSegments_ErrCallBack() {
}()
// checkout the returned error is callback error
- timeout := time.NewTimer(3 * time.Second)
+ timeout := time.NewTimer(10 * time.Second)
select {
case <-timeout.C:
s.Fail("timeout")
@@ -543,7 +550,7 @@ func (s *KafkaSuite) TestKafka_PubSubWithSegments_MessageTimeout() {
}()
// checkout the returned error is callback error
- timeout := time.NewTimer(3 * time.Second)
+ timeout := time.NewTimer(10 * time.Second)
select {
case <-timeout.C:
s.Fail("timeout")
@@ -580,6 +587,5 @@ func (s *KafkaSuite) TestKafka_Consumer_AddTopicAndHandler_Error() {
}
func TestKafkaSuite(t *testing.T) {
- // TODO: revive after CircleCI image fix
- // suite.Run(t, new(KafkaSuite))
+ suite.Run(t, new(KafkaSuite))
} |
ebd6a2e
to
e76faae
Compare
ddcf180
to
8a1748f
Compare
yoomee1313
approved these changes
May 13, 2024
blukat29
approved these changes
May 13, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed changes
Types of changes
Please put an x in the boxes related to your change.
Checklist
Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.
$ make test
)Related issues
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...