Skip to content

Commit

Permalink
feat(020): rename package name to github.com/4paradigm/openmldb-go-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
aceforeverd committed Mar 28, 2024
1 parent 3c2712e commit 47f7565
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# This workflow runs SDK related jobs for OpenMLDB
name: SDK

on:
Expand Down Expand Up @@ -34,15 +33,12 @@ jobs:
docker compose -f docker-compose.yml exec openmldb-ns1 /opt/openmldb/bin/openmldb --zk_cluster=openmldb-zk:2181 --zk_root_path=/openmldb --role=sql_client --cmd 'SET GLOBAL execute_mode = "online"'
- name: go test
env:
OPENMLDB_APISERVER_HOST: 127.0.0.1
OPENMLDB_APISERVER_PORT: 9527
run: go test ./... -race -covermode=atomic -coverprofile=coverage.out

- name: Coverage
uses: codecov/codecov-action@v4
with:
files: go/coverage.out
files: coverage.out
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ _testmain.go
*.prof

output.log

coverage.out
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/4paradigm/OpenMLDB/go
module github.com/4paradigm/openmldb-go-sdk

go 1.18

Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
22 changes: 16 additions & 6 deletions go_sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@ package openmldb_test
import (
"context"
"database/sql"
"flag"
"fmt"
"log"
"os"
"testing"

// register openmldb driver
_ "github.com/4paradigm/OpenMLDB/go"
_ "github.com/4paradigm/openmldb-go-sdk"
"github.com/stretchr/testify/assert"
)

var (
OPENMLDB_APISERVER_HOST = os.Getenv("OPENMLDB_APISERVER_HOST")
OPENMLDB_APISERVER_PORT = os.Getenv("OPENMLDB_APISERVER_PORT")
)
var apiServer string

func Test_driver(t *testing.T) {
db, err := sql.Open("openmldb", fmt.Sprintf("openmldb://%s:%s/test_db", OPENMLDB_APISERVER_HOST, OPENMLDB_APISERVER_PORT))
db, err := sql.Open("openmldb", fmt.Sprintf("openmldb://%s/test_db", apiServer))
if err != nil {
t.Errorf("fail to open connect: %s", err)
}
Expand Down Expand Up @@ -100,3 +99,14 @@ func Test_driver(t *testing.T) {
}
})
}

func TestMain(m *testing.M) {
flag.StringVar(&apiServer, "apiserver", "127.0.0.1:9527", "endpoint to apiserver")
flag.Parse()

if len(apiServer) == 0 {
log.Fatalf("non-empty api server address required")
}

os.Exit(m.Run())
}

0 comments on commit 47f7565

Please sign in to comment.