You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by "chengxilo (via GitHub)" <gi...@apache.org> on 2025/07/17 21:21:10 UTC

[PR] feat: add real go bdd test. [iggy]

chengxilo opened a new pull request, #2021:
URL: https://github.com/apache/iggy/pull/2021

   This pr handle the issue #1986 
   
   1. add a real bdd test for golang sdk.
   2. update the Dockerfile and docker-compose
   3. fix a small bug in iggy message header deserialization
   
   I still keep the previous tcp_test there since it needs to run with a iggy server and it is still useful.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(go): add godog go bdd test according to scenarios. [iggy]

Posted by "spetz (via GitHub)" <gi...@apache.org>.
spetz merged PR #2021:
URL: https://github.com/apache/iggy/pull/2021


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(go): add godog go bdd test according to scenarios. [iggy]

Posted by "haze518 (via GitHub)" <gi...@apache.org>.
haze518 commented on PR #2021:
URL: https://github.com/apache/iggy/pull/2021#issuecomment-3111572334

   LGTM!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: add godog go bdd test according to scenarios. [iggy]

Posted by "chengxilo (via GitHub)" <gi...@apache.org>.
chengxilo commented on code in PR #2021:
URL: https://github.com/apache/iggy/pull/2021#discussion_r2216409877


##########
bdd/go/tests/basic_messaging_test.go:
##########
@@ -0,0 +1,353 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package tests
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	iggcon "github.com/apache/iggy/foreign/go/contracts"
+	"github.com/apache/iggy/foreign/go/iggycli"
+	"github.com/apache/iggy/foreign/go/tcp"
+	"github.com/cucumber/godog"
+	"github.com/google/uuid"
+	"os"
+	"testing"
+)
+
+// TODO: When godog supports uint32, update all relevant arguments from int to uint32 for type safety.

Review Comment:
   This TODO would be handled if https://github.com/cucumber/godog/pull/695 is approved.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(go): add godog go bdd test according to scenarios. [iggy]

Posted by "chengxilo (via GitHub)" <gi...@apache.org>.
chengxilo commented on code in PR #2021:
URL: https://github.com/apache/iggy/pull/2021#discussion_r2224155199


##########
bdd/go/tests/basic_messaging_test.go:
##########
@@ -0,0 +1,351 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package tests
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	iggcon "github.com/apache/iggy/foreign/go/contracts"
+	"github.com/apache/iggy/foreign/go/iggycli"
+	"github.com/apache/iggy/foreign/go/tcp"
+	"github.com/cucumber/godog"
+	"github.com/google/uuid"
+	"os"
+	"testing"
+)
+
+type (
+	serverAddrKeyType          struct{}
+	clientKeyType              struct{}
+	lastSentMessageKeyType     struct{}
+	lastPollMessagesKeyType    struct{}
+	lastStreamIDKeyType        struct{}
+	lastStreamNameKeyType      struct{}
+	lastTopicIDKeyType         struct{}
+	lastTopicNameKeyType       struct{}
+	lastTopicPartitionsKeyType struct{}
+)
+
+var (
+	ServerAddrKey          = serverAddrKeyType{}
+	ClientKey              = clientKeyType{}
+	LastSentMessageKey     = lastSentMessageKeyType{}
+	LastPollMessagesKey    = lastPollMessagesKeyType{}
+	LastStreamIDKey        = lastStreamIDKeyType{}
+	LastStreamNameKey      = lastStreamNameKeyType{}
+	LastTopicIDKey         = lastTopicIDKeyType{}
+	LastTopicNameKey       = lastTopicNameKeyType{}
+	LastTopicPartitionsKey = lastTopicPartitionsKeyType{}
+)
+
+func givenRunningServer(ctx context.Context) (context.Context, error) {
+	addr := os.Getenv("IGGY_TCP_ADDRESS")
+	if addr == "" {
+		addr = "127.0.0.1:8090"
+	}
+	return context.WithValue(ctx, ServerAddrKey, addr), nil
+}
+func givenAuthenticationAsRoot(ctx context.Context) (context.Context, error) {
+	serverAddr := ctx.Value(ServerAddrKey).(string)

Review Comment:
   Your suggestion is quite resonable. Maybe we don't need to wait the bdd test to be "bigger". I can update this pr tonight or tommorrow.🫡



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(go): add godog go bdd test according to scenarios. [iggy]

Posted by "chengxilo (via GitHub)" <gi...@apache.org>.
chengxilo commented on PR #2021:
URL: https://github.com/apache/iggy/pull/2021#issuecomment-3111816366

   After reading the source code and example in godog more scrupulously, I realized that actually the `context.Context` doesn't need to be returned. It's a stupid mistake, and I fixed it. Sorry for the inconvenience.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(go): add godog go bdd test according to scenarios. [iggy]

Posted by "haze518 (via GitHub)" <gi...@apache.org>.
haze518 commented on code in PR #2021:
URL: https://github.com/apache/iggy/pull/2021#discussion_r2224110426


##########
bdd/go/tests/basic_messaging_test.go:
##########
@@ -0,0 +1,351 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package tests
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	iggcon "github.com/apache/iggy/foreign/go/contracts"
+	"github.com/apache/iggy/foreign/go/iggycli"
+	"github.com/apache/iggy/foreign/go/tcp"
+	"github.com/cucumber/godog"
+	"github.com/google/uuid"
+	"os"
+	"testing"
+)
+
+type (
+	serverAddrKeyType          struct{}
+	clientKeyType              struct{}
+	lastSentMessageKeyType     struct{}
+	lastPollMessagesKeyType    struct{}
+	lastStreamIDKeyType        struct{}
+	lastStreamNameKeyType      struct{}
+	lastTopicIDKeyType         struct{}
+	lastTopicNameKeyType       struct{}
+	lastTopicPartitionsKeyType struct{}
+)
+
+var (
+	ServerAddrKey          = serverAddrKeyType{}
+	ClientKey              = clientKeyType{}
+	LastSentMessageKey     = lastSentMessageKeyType{}
+	LastPollMessagesKey    = lastPollMessagesKeyType{}
+	LastStreamIDKey        = lastStreamIDKeyType{}
+	LastStreamNameKey      = lastStreamNameKeyType{}
+	LastTopicIDKey         = lastTopicIDKeyType{}
+	LastTopicNameKey       = lastTopicNameKeyType{}
+	LastTopicPartitionsKey = lastTopicPartitionsKeyType{}
+)
+
+func givenRunningServer(ctx context.Context) (context.Context, error) {
+	addr := os.Getenv("IGGY_TCP_ADDRESS")
+	if addr == "" {
+		addr = "127.0.0.1:8090"
+	}
+	return context.WithValue(ctx, ServerAddrKey, addr), nil
+}
+func givenAuthenticationAsRoot(ctx context.Context) (context.Context, error) {
+	serverAddr := ctx.Value(ServerAddrKey).(string)

Review Comment:
   Since the bdd repo is still small, we can keep storing values in the context for now. However, to be honest, I’m not a big fan of this approach because we can’t really see what’s stored in the go context - there’s a certain lack of clarity and transparency here.
   
   I suggest we leave it as is for the time being, but if the bdd coverage grows in the future, we can revisit this approach. For example, we could eventually introduce a structure similar to GlobalContext from the rust implementation, which would be stored in the context (likely as a single struct instead of multiple separate keys)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org