This is an automated email from the ASF dual-hosted git repository.
imbajin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hugegraph-toolchain.git
The following commit(s) were added to refs/heads/master by this push:
new 077802f0 chore(ci): replace hardcoded server commit with latest
release (#732)
077802f0 is described below
commit 077802f015cd771a425f1ad05d6db5761170e154
Author: lokidundun <[email protected]>
AuthorDate: Sat May 9 16:17:06 2026 +0800
chore(ci): replace hardcoded server commit with latest release (#732)
* optimize: remove TODO commitId
* fix: use commit output for loader cache key
---------
Co-authored-by: copilot-swe-agent[bot]
<[email protected]>
---
.github/actions/get-hugegraph-commit/action.yml | 37 +++++++++++++++++++
.github/actions/setup-hugegraph-server/action.yml | 18 ++++++++++
.github/actions/setup-java-env/action.yml | 33 +++++++++++++++++
.github/actions/upload-coverage/action.yml | 20 +++++++++++
.github/workflows/client-ci.yml | 44 +++++++----------------
.github/workflows/client-go-ci.yml | 38 ++++++++------------
.github/workflows/hubble-ci.yml | 32 ++++++-----------
.github/workflows/loader-ci.yml | 33 +++++++----------
.github/workflows/spark-connector-ci.yml | 34 +++++++-----------
.github/workflows/tools-ci.yml | 36 ++++++++-----------
hugegraph-client-go/api/v1/gremlin/gemlin.go | 30 +++++++++++-----
hugegraph-client-go/api/v1/gremlin/gemlin_test.go | 15 +++-----
hugegraph-client-go/hugegraph.go | 11 +++---
13 files changed, 217 insertions(+), 164 deletions(-)
diff --git a/.github/actions/get-hugegraph-commit/action.yml
b/.github/actions/get-hugegraph-commit/action.yml
new file mode 100644
index 00000000..f6cf438d
--- /dev/null
+++ b/.github/actions/get-hugegraph-commit/action.yml
@@ -0,0 +1,37 @@
+name: 'Get HugeGraph stable commit id'
+description: 'Fetch the latest HugeGraph release commit SHA and expose it as
output and env variable'
+
+outputs:
+ commit_id:
+ description: 'The commit SHA of the latest HugeGraph release'
+ value: ${{ steps.get-commit.outputs.commit_id }}
+
+runs:
+ using: composite
+ steps:
+ - name: Get HugeGraph stable commit id
+ id: get-commit
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const owner = 'apache';
+ const repo = 'hugegraph';
+ try {
+ const { data: release } = await
github.rest.repos.getLatestRelease({ owner, repo });
+ const tagName = release.tag_name;
+ const { data: ref } = await github.rest.git.getRef({
+ owner, repo, ref: `tags/${tagName}`
+ });
+ let sha = ref.object.sha;
+ if (ref.object.type === 'tag') {
+ const { data: tag } = await github.rest.git.getTag({ owner,
repo, tag_sha: sha });
+ sha = tag.object.sha;
+ } else if (ref.object.type !== 'commit') {
+ throw new Error(`Unexpected ref type: ${ref.object.type}`);
+ }
+ core.exportVariable('COMMIT_ID', sha);
+ core.setOutput('commit_id', sha);
+ console.log(`Using HugeGraph release ${tagName} (${sha})`);
+ } catch (error) {
+ core.setFailed(`Failed to get HugeGraph commit: ${error.message}`);
+ }
diff --git a/.github/actions/setup-hugegraph-server/action.yml
b/.github/actions/setup-hugegraph-server/action.yml
new file mode 100644
index 00000000..ff142ed1
--- /dev/null
+++ b/.github/actions/setup-hugegraph-server/action.yml
@@ -0,0 +1,18 @@
+name: 'Setup HugeGraph Server'
+description: 'Prepare environment and install HugeGraph server from source'
+
+inputs:
+ travis-dir:
+ description: 'Path to the Travis assembly directory containing install
scripts'
+ required: true
+ commit-id:
+ description: 'HugeGraph commit SHA to install'
+ required: true
+
+runs:
+ using: composite
+ steps:
+ - name: Prepare env and service
+ shell: bash
+ run: |
+ ${{ inputs.travis-dir }}/install-hugegraph-from-source.sh ${{
inputs.commit-id }}
diff --git a/.github/actions/setup-java-env/action.yml
b/.github/actions/setup-java-env/action.yml
new file mode 100644
index 00000000..18b13612
--- /dev/null
+++ b/.github/actions/setup-java-env/action.yml
@@ -0,0 +1,33 @@
+name: 'Setup Java and Maven Environment'
+description: 'Install JDK, cache Maven packages, and optionally apply staged
Maven repository settings'
+
+inputs:
+ java-version:
+ description: 'Java version to install'
+ required: false
+ default: '11'
+ distribution:
+ description: 'JDK distribution'
+ required: false
+ default: 'zulu'
+ use-stage:
+ description: 'Whether to apply staged Maven repository settings'
+ required: false
+ default: 'true'
+
+runs:
+ using: composite
+ steps:
+ - name: Install JDK ${{ inputs.java-version }}
+ uses: actions/setup-java@v4
+ with:
+ java-version: ${{ inputs.java-version }}
+ distribution: ${{ inputs.distribution }}
+ cache: 'maven'
+
+ - name: Use staged maven repo settings
+ if: ${{ inputs.use-stage == 'true' }}
+ shell: bash
+ run: |
+ cp $HOME/.m2/settings.xml /tmp/settings.xml
+ mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml
diff --git a/.github/actions/upload-coverage/action.yml
b/.github/actions/upload-coverage/action.yml
new file mode 100644
index 00000000..7b07b84f
--- /dev/null
+++ b/.github/actions/upload-coverage/action.yml
@@ -0,0 +1,20 @@
+name: 'Upload Coverage to Codecov'
+description: 'Upload test coverage report to Codecov'
+
+inputs:
+ token:
+ description: 'Codecov upload token'
+ required: true
+ file:
+ description: 'Path to the coverage report file'
+ required: false
+ default: 'target/jacoco.xml'
+
+runs:
+ using: composite
+ steps:
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v4
+ with:
+ token: ${{ inputs.token }}
+ file: ${{ inputs.file }}
diff --git a/.github/workflows/client-ci.yml b/.github/workflows/client-ci.yml
index 0551d6ad..9ed4e723 100644
--- a/.github/workflows/client-ci.yml
+++ b/.github/workflows/client-ci.yml
@@ -24,9 +24,6 @@ jobs:
env:
USE_STAGE: 'true' # Whether to include the stage repository.
TRAVIS_DIR: hugegraph-client/assembly/travis
- # TODO: replace it with the (latest - n) commit id (n >= 15)
- # hugegraph commit date: 2025-11-4
- COMMIT_ID: b7998c1
strategy:
fail-fast: false
matrix:
@@ -39,39 +36,22 @@ jobs:
with:
fetch-depth: 2
- # TODO: do we need it? (need test)
- - name: Cache Maven packages
- uses: actions/cache@v4
- with:
- path: ~/.m2/repository
- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- restore-keys: ${{ runner.os }}-maven-
-
- - name: Install JDK 11 for graph server
- uses: actions/setup-java@v4
- with:
- java-version: '11'
- distribution: 'zulu'
- cache: 'maven'
+ - name: Get HugeGraph stable commit id
+ id: get-commit
+ uses: ./.github/actions/get-hugegraph-commit
- - name: Prepare env and service
- run: |
- # TODO(@Thespica): test both servers of supporting gs and not
supporting gs
- # when the server supports gs
- $TRAVIS_DIR/install-hugegraph-from-source.sh $COMMIT_ID
-
- - name: Install Java ${{ matrix.JAVA_VERSION }} for client
- uses: actions/setup-java@v4
+ - name: Setup Java environment
+ uses: ./.github/actions/setup-java-env
with:
java-version: ${{ matrix.JAVA_VERSION }}
distribution: 'zulu'
- cache: 'maven'
+ use-stage: ${{ env.USE_STAGE }}
- - name: Use staged maven repo
- if: ${{ env.USE_STAGE == 'true' }}
- run: |
- cp $HOME/.m2/settings.xml /tmp/settings.xml
- mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml
+ - name: Setup HugeGraph server
+ uses: ./.github/actions/setup-hugegraph-server
+ with:
+ travis-dir: ${{ env.TRAVIS_DIR }}
+ commit-id: ${{ steps.get-commit.outputs.commit_id }}
- name: Compile
run: |
@@ -85,7 +65,7 @@ jobs:
mvn test -Dtest=FuncTestSuite
- name: Upload coverage to Codecov
- uses: codecov/codecov-action@v3
+ uses: ./.github/actions/upload-coverage
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: target/jacoco.xml
diff --git a/.github/workflows/client-go-ci.yml
b/.github/workflows/client-go-ci.yml
index 45064073..9c14711e 100644
--- a/.github/workflows/client-go-ci.yml
+++ b/.github/workflows/client-go-ci.yml
@@ -23,9 +23,6 @@ jobs:
env:
USE_STAGE: 'true' # Whether to include the stage repository.
TRAVIS_DIR: hugegraph-client/assembly/travis
- # TODO: replace it with the (latest - n) commit id (n >= 15)
- # FIXME: hugegraph commit date: 2025-10-30
- COMMIT_ID: 8c1ee71 # 5b3d295
strategy:
fail-fast: false
matrix:
@@ -37,36 +34,31 @@ jobs:
with:
fetch-depth: 2
- - name: Install JDK 11
- uses: actions/setup-java@v3
+ - name: Get HugeGraph stable commit id
+ id: get-commit
+ uses: ./.github/actions/get-hugegraph-commit
+
+ - name: Setup Java environment
+ uses: ./.github/actions/setup-java-env
with:
java-version: ${{ matrix.JAVA_VERSION }}
distribution: 'zulu'
+ use-stage: ${{ env.USE_STAGE }}
- - name: Cache Maven packages
- uses: actions/cache@v3
+ - name: Setup HugeGraph server
+ uses: ./.github/actions/setup-hugegraph-server
with:
- path: ~/.m2
- key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
- restore-keys: ${{ runner.os }}-m2
-
- - name: Use staged maven repo
- if: ${{ env.USE_STAGE == 'true' }}
- run: |
- cp $HOME/.m2/settings.xml /tmp/settings.xml
- mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml
-
- - name: Prepare env and service
- run: |
- $TRAVIS_DIR/install-hugegraph-from-source.sh $COMMIT_ID
+ travis-dir: ${{ env.TRAVIS_DIR }}
+ commit-id: ${{ steps.get-commit.outputs.commit_id }}
- name: Init Go env
- uses: actions/[email protected]
- with: {go-version: '1.x'}
+ uses: actions/setup-go@v5
+ with:
+ go-version: '1.x'
- name: Go test
run: |
- go version
+ go version
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
diff --git a/.github/workflows/hubble-ci.yml b/.github/workflows/hubble-ci.yml
index 4cd3f778..2b09e74f 100644
--- a/.github/workflows/hubble-ci.yml
+++ b/.github/workflows/hubble-ci.yml
@@ -23,9 +23,6 @@ on:
env:
TRAVIS_DIR: hugegraph-hubble/hubble-dist/assembly/travis
- # TODO: replace it with the (latest - n) commit id (n >= 15)
- # FIXME: hugegraph commit date: 2025-10-30
- COMMIT_ID: 8c1ee71 # 5b3d295
jobs:
hubble-ci:
@@ -44,11 +41,16 @@ jobs:
with:
fetch-depth: 2
- - name: Install JDK 11
- uses: actions/setup-java@v3
+ - name: Get HugeGraph stable commit id
+ id: get-commit
+ uses: ./.github/actions/get-hugegraph-commit
+
+ - name: Setup Java environment
+ uses: ./.github/actions/setup-java-env
with:
java-version: ${{ matrix.JAVA_VERSION }}
distribution: 'adopt'
+ use-stage: ${{ env.USE_STAGE }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
@@ -56,21 +58,6 @@ jobs:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- # we also should cache python & yarn & downloads to avoid useless work
- - name: Cache Maven packages
- uses: actions/cache@v3
- with:
- path: ~/.m2/repository
- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- restore-keys: |
- ${{ runner.os }}-maven-
-
- - name: use staged maven repo settings
- if: ${{ env.USE_STAGE == 'true' }}
- run: |
- cp $HOME/.m2/settings.xml /tmp/settings.xml
- mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml
-
- name: Compile
run: |
mvn install -pl hugegraph-client,hugegraph-loader -am
-Dmaven.javadoc.skip=true -DskipTests -ntp
@@ -78,8 +65,9 @@ jobs:
mvn -e compile -Dmaven.javadoc.skip=true -ntp
- name: Prepare env and service
+ env:
+ COMMIT_ID: ${{ steps.get-commit.outputs.commit_id }}
run: |
-
python -m pip install -r ${TRAVIS_DIR}/requirements.txt
cd hugegraph-hubble
mvn package -Dmaven.test.skip=true
@@ -102,7 +90,7 @@ jobs:
hubble-dist/assembly/travis/run-api-test.sh
- name: Upload coverage to Codecov
- uses: codecov/codecov-action@v3
+ uses: ./.github/actions/upload-coverage
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: target/site/jacoco/*.xml
diff --git a/.github/workflows/loader-ci.yml b/.github/workflows/loader-ci.yml
index d992117b..a7b085ab 100644
--- a/.github/workflows/loader-ci.yml
+++ b/.github/workflows/loader-ci.yml
@@ -26,9 +26,6 @@ jobs:
USE_STAGE: 'true' # Whether to include the stage repository.
TRAVIS_DIR: hugegraph-loader/assembly/travis
STATIC_DIR: hugegraph-loader/assembly/static
- # TODO: replace it with the (latest - n) commit id (n >= 15)
- # hugegraph commit date: 2025-10-30
- COMMIT_ID: 5b3d295
DB_USER: root
DB_PASS: root
DB_DATABASE: load_test
@@ -50,18 +47,16 @@ jobs:
with:
fetch-depth: 2
- - name: Install JDK 11
- uses: actions/setup-java@v4
+ - name: Get HugeGraph stable commit id
+ id: get-commit
+ uses: ./.github/actions/get-hugegraph-commit
+
+ - name: Setup Java environment
+ uses: ./.github/actions/setup-java-env
with:
java-version: ${{ matrix.JAVA_VERSION }}
distribution: 'adopt'
-
- - name: Cache Maven packages
- uses: actions/cache@v4
- with:
- path: ~/.m2
- key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
- restore-keys: ${{ runner.os }}-m2
+ use-stage: ${{ env.USE_STAGE }}
- name: Cache Hadoop
uses: actions/cache@v4
@@ -72,20 +67,16 @@ jobs:
- name: Cache HugeGraph Server
uses: actions/cache@v4
with:
- path: ~/hugegraph-cache-${{ env.COMMIT_ID }}
- key: ${{ runner.os }}-hugegraph-server-${{ env.COMMIT_ID }}
-
- - name: use staged maven repo settings
- if: ${{ env.USE_STAGE == 'true' }}
- run: |
- cp $HOME/.m2/settings.xml /tmp/settings.xml
- mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml
+ path: ~/hugegraph-cache-${{ steps.get-commit.outputs.commit_id }}
+ key: ${{ runner.os }}-hugegraph-server-${{
steps.get-commit.outputs.commit_id }}
- name: Compile
run: |
mvn install -pl hugegraph-client,hugegraph-loader -am
-Dmaven.javadoc.skip=true -DskipTests -ntp
- name: Prepare env and service
+ env:
+ COMMIT_ID: ${{ steps.get-commit.outputs.commit_id }}
run: |
$TRAVIS_DIR/install-hadoop.sh
$TRAVIS_DIR/install-hugegraph-from-source.sh $COMMIT_ID
@@ -100,7 +91,7 @@ jobs:
mvn test -P kafka
- name: Upload coverage to Codecov
- uses: codecov/codecov-action@v4
+ uses: ./.github/actions/upload-coverage
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: target/jacoco.xml
diff --git a/.github/workflows/spark-connector-ci.yml
b/.github/workflows/spark-connector-ci.yml
index 4c077e9e..b61b56e2 100644
--- a/.github/workflows/spark-connector-ci.yml
+++ b/.github/workflows/spark-connector-ci.yml
@@ -25,8 +25,6 @@ jobs:
env:
USE_STAGE: 'true' # Whether to include the stage repository.
TRAVIS_DIR: hugegraph-spark-connector/assembly/travis
- # hugegraph commit date: 2025-10-30
- COMMIT_ID: 5b3d295
strategy:
matrix:
JAVA_VERSION: [ '11' ]
@@ -37,32 +35,26 @@ jobs:
with:
fetch-depth: 2
- - name: Install JDK 11
- uses: actions/setup-java@v4
- with:
- java-version: '11'
- distribution: 'adopt'
+ - name: Get HugeGraph stable commit id
+ id: get-commit
+ uses: ./.github/actions/get-hugegraph-commit
- - name: Cache Maven packages
- uses: actions/cache@v3
+ - name: Setup Java environment
+ uses: ./.github/actions/setup-java-env
with:
- path: ~/.m2
- key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
- restore-keys: ${{ runner.os }}-m2
-
- - name: use staged maven repo settings
- if: ${{ env.USE_STAGE == 'true' }}
- run: |
- cp $HOME/.m2/settings.xml /tmp/settings.xml
- mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml
+ java-version: ${{ matrix.JAVA_VERSION }}
+ distribution: 'adopt'
+ use-stage: ${{ env.USE_STAGE }}
- name: Compile
run: |
mvn install -pl hugegraph-client,hugegraph-spark-connector -am
-Dmaven.javadoc.skip=true -DskipTests -ntp
- - name: Prepare env and service
- run: |
- $TRAVIS_DIR/install-hugegraph-from-source.sh $COMMIT_ID
+ - name: Setup HugeGraph server
+ uses: ./.github/actions/setup-hugegraph-server
+ with:
+ travis-dir: ${{ env.TRAVIS_DIR }}
+ commit-id: ${{ steps.get-commit.outputs.commit_id }}
- name: Run test
run: |
diff --git a/.github/workflows/tools-ci.yml b/.github/workflows/tools-ci.yml
index 2ee9143c..dda37f3e 100644
--- a/.github/workflows/tools-ci.yml
+++ b/.github/workflows/tools-ci.yml
@@ -1,4 +1,5 @@
name: "tools-ci"
+
on:
workflow_dispatch:
push:
@@ -24,10 +25,6 @@ jobs:
env:
USE_STAGE: 'true' # Whether to include the stage repository.
TRAVIS_DIR: hugegraph-tools/assembly/travis
- # TODO: could we use one param to unify it? or use a action template
(could use one ci file)
- # TODO: replace it with the (latest - n) commit id (n >= 15)
- # hugegraph commit date: 2025-11-4
- COMMIT_ID: b7998c1
strategy:
matrix:
JAVA_VERSION: [ '11' ]
@@ -38,38 +35,33 @@ jobs:
with:
fetch-depth: 2
- - name: Install JDK 11
- uses: actions/setup-java@v3
+ - name: Get HugeGraph stable commit id
+ id: get-commit
+ uses: ./.github/actions/get-hugegraph-commit
+
+ - name: Setup Java environment
+ uses: ./.github/actions/setup-java-env
with:
java-version: ${{ matrix.JAVA_VERSION }}
distribution: 'adopt'
- - name: Cache Maven packages
- uses: actions/cache@v3
- with:
- path: ~/.m2
- key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
- restore-keys: ${{ runner.os }}-m2
-
- - name: use staged maven repo settings
- if: ${{ env.USE_STAGE == 'true' }}
- run: |
- cp $HOME/.m2/settings.xml /tmp/settings.xml
- mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml
+ use-stage: ${{ env.USE_STAGE }}
- name: Compile
run: |
mvn install -pl hugegraph-client,hugegraph-tools -am
-Dmaven.javadoc.skip=true -DskipTests -ntp
- - name: Prepare env and service
- run: |
- $TRAVIS_DIR/install-hugegraph-from-source.sh $COMMIT_ID
+ - name: Setup HugeGraph server
+ uses: ./.github/actions/setup-hugegraph-server
+ with:
+ travis-dir: ${{ env.TRAVIS_DIR }}
+ commit-id: ${{ steps.get-commit.outputs.commit_id }}
- name: Run test
run: |
mvn test -Dtest=FuncTestSuite -pl hugegraph-tools -ntp
- name: Upload coverage to Codecov
- uses: codecov/codecov-action@v3
+ uses: ./.github/actions/upload-coverage
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: target/jacoco.xml
diff --git a/hugegraph-client-go/api/v1/gremlin/gemlin.go
b/hugegraph-client-go/api/v1/gremlin/gemlin.go
index a2c3112b..c6ddd04e 100644
--- a/hugegraph-client-go/api/v1/gremlin/gemlin.go
+++ b/hugegraph-client-go/api/v1/gremlin/gemlin.go
@@ -83,19 +83,13 @@ type PostRequest struct {
gremlin string
bindings map[string]string
language string
- aliases struct {
- //Graph string `json:"graph"`
- //G string `json:"g"`
- }
+ aliases map[string]string
}
type PostRequestData struct {
Gremlin string `json:"gremlin"`
Bindings map[string]string `json:"bindings,omitempty"`
Language string `json:"language,omitempty"`
- Aliases struct {
- //Graph string `json:"graph"`
- //G string `json:"g"`
- } `json:"aliases,omitempty"`
+ Aliases map[string]string `json:"aliases,omitempty"`
}
type PostResponse struct {
StatusCode int `json:"-"`
@@ -132,6 +126,22 @@ func (g Post) WithGremlin(gremlin string) func(request
*PostRequest) {
}
}
+func buildDefaultAliases(transport api.Transport) map[string]string {
+ cfg := transport.GetConfig()
+ graphSpace := cfg.GraphSpace
+ if graphSpace == "" {
+ graphSpace = "DEFAULT"
+ }
+ if cfg.Graph == "" {
+ cfg.Graph = "hugegraph"
+ }
+ full := graphSpace + "-" + cfg.Graph
+ return map[string]string{
+ "graph": full,
+ "g": "__g_" + full,
+ }
+}
+
func (g GetRequest) Do(ctx context.Context, transport api.Transport)
(*GetResponse, error) {
url := "/gremlin"
@@ -195,6 +205,10 @@ func (g PostRequest) Do(ctx context.Context, transport
api.Transport) (*PostResp
g.language = "gremlin-groovy"
}
+ if g.aliases == nil {
+ g.aliases = buildDefaultAliases(transport)
+ }
+
gd := &PostRequestData{
Gremlin: g.gremlin,
Bindings: g.bindings,
diff --git a/hugegraph-client-go/api/v1/gremlin/gemlin_test.go
b/hugegraph-client-go/api/v1/gremlin/gemlin_test.go
index d880c887..5ab2d8ab 100644
--- a/hugegraph-client-go/api/v1/gremlin/gemlin_test.go
+++ b/hugegraph-client-go/api/v1/gremlin/gemlin_test.go
@@ -31,22 +31,17 @@ func TestGremlin(t *testing.T) {
if err != nil {
log.Println(err)
}
- respGet, err := client.Gremlin.Get(
- client.Gremlin.Get.WithGremlin("hugegraph.traversal().V().limit(3)"),
- )
- if err != nil {
- log.Fatalln(err)
- }
- if respGet.StatusCode != 200 {
- t.Error("client.Gremlin.GremlinGet error ")
- }
respPost, err := client.Gremlin.Post(
- client.Gremlin.Post.WithGremlin("hugegraph.traversal().V().limit(3)"),
+ client.Gremlin.Post.WithGremlin("g.V().limit(3)"),
)
if err != nil {
log.Fatalln(err)
}
+ if respPost.StatusCode != 200 {
+ t.Errorf("client.Gremlin.Post http_status=%d, gremlin_status=%d,
message=%s",
+ respPost.StatusCode, respPost.Data.Status.Code,
respPost.Data.Status.Message)
+ }
fmt.Println(respPost.Data.Result.Data)
}
diff --git a/hugegraph-client-go/hugegraph.go b/hugegraph-client-go/hugegraph.go
index 5e5a5f30..a1797842 100644
--- a/hugegraph-client-go/hugegraph.go
+++ b/hugegraph-client-go/hugegraph.go
@@ -92,11 +92,12 @@ func NewCommonClient(cfg Config) (*CommonClient, error) {
Host: fmt.Sprintf("%s:%d", cfg.Host, cfg.Port),
Scheme: "http",
},
- Username: cfg.Username,
- Password: cfg.Password,
- Graph: cfg.Graph,
- Transport: cfg.Transport,
- Logger: cfg.Logger,
+ Username: cfg.Username,
+ Password: cfg.Password,
+ GraphSpace: cfg.GraphSpace,
+ Graph: cfg.Graph,
+ Transport: cfg.Transport,
+ Logger: cfg.Logger,
})
return &CommonClient{