luoluoyuyu commented on code in PR #3261:
URL: https://github.com/apache/streampipes/pull/3261#discussion_r1819412100


##########
streampipes-client-e2e/go-client-e2e/go.sum:
##########
@@ -0,0 +1 @@
+github.com/apache/streampipes/streampipes-client-go 
v0.0.0-20240927072147-472569d5e1fb/go.mod 
h1:D7TeoMYCcSveKDVfJTkib3p1//1yA+egeNF6/j9vsuw=

Review Comment:
   Maybe the sum file is not needed, the local code of streampipes-go-client is 
directly introduced in the mod file?



##########
streampipes-client-e2e/README.md:
##########
@@ -0,0 +1,46 @@
+<!--
+  ~ 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.
+  ~
+  -->
+
+# Client E2E
+
+## Environment Setup
+Before running, ensure that StreamPipe is operational and the corresponding 
configuration is input into the `start-streampipes-client-e2e.sh` script.
+**Note**: This script must be executed from within the [tool](./tool) 
directory.
+```shell
+./start-streampipes-client-e2e.sh -h 127.0.0.1 -p 8030 -u 
[email protected]   -pw admin -t go-client-e2e.sh
+```
+
+## Usage Instructions
+| Parameter | Default          | Required | Description                        
                                                                       |
+|-----------|-------------------|----------|-----------------------------------------------------------------------------------------------------------|
+| `-h`      | `127.0.0.1`       | No       | Host address                      
                                                                        |
+| `-p`      | `8030`            | No       | Backend port                      
                                                                        |
+| `-u`      | `[email protected]` | Yes      | User                 
                                                                                
     |

Review Comment:
   The -u in the script is not necessary, it is wrong here



##########
streampipes-client-e2e/go-client-e2e/adapter_test.go:
##########
@@ -0,0 +1,130 @@
+//
+// 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 go_client_e2e
+
+import (
+       "go-client-e2e/utils"
+       "os"
+       "testing"
+)
+
+const (
+       E2E_ADAPTER_ID             = "e2e-adapter-id"
+       E2E_ADAPTER_NAME           = "e2e-adapter-name"
+       E2E_STREAM_REV             = "e2e-stream-rev"
+       E2E_HOST_NAME              = "e2e-host-name"
+       E2E_ADAPTER_OUT_TOPIC_NAME = "e2e-adapter-out-topic-name"
+       E2E_PORT                   = "\"e2e-port\""
+)
+
+func TestCreateAdapter(t *testing.T) {
+       TestDeleteAdapter(t)
+       streamPipesClient, err := utils.CreateStreamPipesClient()
+       if err != nil {
+               os.Exit(1)
+       }

Review Comment:
   Maybe you can print out the error log to facilitate finding the problem



##########
streampipes-client-e2e/go-client-e2e/utils/generate_id.go:
##########
@@ -0,0 +1,38 @@
+//
+// 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 utils
+
+import (
+       "crypto/rand"
+)
+
+const (
+       letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+)
+
+func GenerateID(length int) string {
+       bytes := make([]byte, length)
+       if _, err := rand.Read(bytes); err != nil {
+               return ""
+       }
+
+       for i, b := range bytes {
+               bytes[i] = letters[b%byte(length)]
+       }
+       return string(bytes)
+}

Review Comment:
   This function is not used and may be deleted



##########
.github/workflows/go-client-e2e-test.yml:
##########
@@ -0,0 +1,69 @@
+# 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.
+
+name: run-e2e-tests
+
+on:
+  pull_request:
+
+jobs:
+  build-and-push-to-docker:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v1
+
+      - name: Cache Docker layers
+        uses: actions/cache@v2
+        with:
+          path: /tmp/.buildx-cache
+          key: ${{ runner.os }}-buildx-${{ github.sha }}
+          restore-keys: |
+            ${{ runner.os }}-buildx-
+
+      - name: Set up Go 1.21
+        uses: actions/setup-go@v3
+        with:
+          go-version: '1.21'
+
+      - name: Set up JDK 17
+        uses: actions/setup-java@v4
+        with:
+          distribution: 'temurin'
+          java-version: '17'
+          cache: 'maven'
+
+      - name: Build with Maven
+        run: mvn clean install
+
+      - name: Build Docker image
+        run: |
+          docker build -t 
streampipes_pipeline-elements-all-jvm:release-validation 
./streampipes-extensions/streampipes-extensions-all-jvm
+          docker build -t streampipes_backend:release-validation 
./streampipes-service-core
+
+      - name: build image
+        run: docker images

Review Comment:
   This part can be deleted



##########
streampipes-client-e2e/go-client-e2e/adapter_test.go:
##########
@@ -0,0 +1,130 @@
+//
+// 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 go_client_e2e
+
+import (
+       "go-client-e2e/utils"
+       "os"
+       "testing"
+)
+
+const (
+       E2E_ADAPTER_ID             = "e2e-adapter-id"
+       E2E_ADAPTER_NAME           = "e2e-adapter-name"
+       E2E_STREAM_REV             = "e2e-stream-rev"
+       E2E_HOST_NAME              = "e2e-host-name"
+       E2E_ADAPTER_OUT_TOPIC_NAME = "e2e-adapter-out-topic-name"
+       E2E_PORT                   = "\"e2e-port\""
+)
+
+func TestCreateAdapter(t *testing.T) {
+       TestDeleteAdapter(t)
+       streamPipesClient, err := utils.CreateStreamPipesClient()
+       if err != nil {
+               os.Exit(1)
+       }
+       data := utils.CreateData("adapter/machine.json")
+       err = streamPipesClient.Adapter().CreateAdapter(data)
+       if err != nil {
+               os.Exit(1)
+       }
+}
+
+func TestGetAdapter(t *testing.T) {
+       streamPipesClient, err := utils.CreateStreamPipesClient()
+       if err != nil {
+               t.Error(err)
+               os.Exit(1)
+       }
+       adapters, err1 := streamPipesClient.Adapter().GetAllAdapter()
+       if err1 != nil {
+               t.Error(err1)
+               os.Exit(1)
+       }
+       if len(adapters) == 0 {
+               os.Exit(1)
+       }
+}
+
+func TestStartAdapter(t *testing.T) {
+       streamPipesClient, err := utils.CreateStreamPipesClient()
+       if err != nil {
+               t.Error(err)
+               os.Exit(1)
+       }
+       adapters, err1 := streamPipesClient.Adapter().GetAllAdapter()
+       if err1 != nil {
+               t.Error(err1)
+               os.Exit(1)
+       }
+       if len(adapters) == 0 {
+               os.Exit(1)
+       }

Review Comment:
   Logs are needed here



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to