Skip to content

Commit

Permalink
Remove console from docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
Aiee committed Jan 6, 2022
1 parent ff263f7 commit 20f81f0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 20 deletions.
32 changes: 32 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"encoding/json"
"fmt"
"log"
"os"
"os/exec"
"sync"
"testing"
Expand Down Expand Up @@ -58,6 +59,11 @@ func logoutAndClose(conn *connection, sessionID int64) {
conn.close()
}

func TestMain(m *testing.M) {
addHosts()
os.Exit(m.Run())
}

func TestConnection(t *testing.T) {
hostAdress := HostAddress{Host: address, Port: port}
conn := newConnection(hostAdress)
Expand Down Expand Up @@ -1322,3 +1328,29 @@ func dropSpace(t *testing.T, session *Session, spaceName string) {
}
checkResultSet(t, query, resultSet)
}

func addHosts() {
hostAdress := HostAddress{Host: address, Port: port}
conn := newConnection(hostAdress)
err := conn.open(hostAdress, testPoolConfig.TimeOut, nil)
if err != nil {
log.Fatalf("fail to open connection, address: %s, port: %d, %s", address, port, err.Error())
}
authresp, authErr := conn.authenticate(username, password)
if authErr != nil {
log.Fatalf("fail to authenticate, username: %s, password: %s, %s", username, password, authErr.Error())
}

sessionID := authresp.GetSessionID()

defer logoutAndClose(conn, sessionID)
// Hard-coded storage address
resp, err := conn.execute(sessionID, `ADD HOSTS "storaged0":44500,"storaged1":44500,"storaged2":44500`)
if err != nil {
log.Fatalf(err.Error())
return
}
if IsError(resp) {
log.Fatalf("%s, ErrorCode: %v, ErrorMsg: %s", "ADD HOSTS failed", resp.ErrorCode, resp.ErrorMsg)
}
}
20 changes: 0 additions & 20 deletions nebula-docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -410,25 +410,5 @@ services:
cap_add:
- SYS_PTRACE

console:
image: vesoft/nebula-console:nightly
entrypoint: ""
command:
- sh
- -c
- |
for i in `seq 1 60`;do
var=`nebula-console -addr graphd -port 3699 -u root -p nebula -enable_ssl ${enable_ssl} -ssl_root_ca_path ${ca_path} -ssl_cert_path ${cert_path} -ssl_private_key_path ${key_path} -ssl_insecure_skip_verify true -e 'ADD HOSTS "storaged0":44500,"storaged1":44500,"storaged2":44500'`;
if [[ $$? == 0 ]];then
break;
fi;
sleep 1;
echo "retry to add hosts.";
done && tail -f /dev/null;
depends_on:
- graphd
networks:
- nebula-net

networks:
nebula-net:

0 comments on commit 20f81f0

Please sign in to comment.