-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multiple database for DPU #174
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -678,7 +678,7 @@ func prepareDb(t *testing.T, namespace string) { | |
} | ||
|
||
func prepareDbTranslib(t *testing.T) { | ||
rclient := getRedisClient(t, sdcfg.GetDbDefaultNamespace()) | ||
rclient := getRedisClient(t, sdcfg.GetDbDefaultInstance()) | ||
rclient.FlushDB() | ||
rclient.Close() | ||
|
||
|
@@ -698,7 +698,7 @@ func prepareDbTranslib(t *testing.T) { | |
t.Fatalf("read file %v err: %v", fileName, err) | ||
} | ||
for n, v := range rj { | ||
rclient := getRedisClientN(t, n, sdcfg.GetDbDefaultNamespace()) | ||
rclient := getRedisClientN(t, n, sdcfg.GetDbDefaultInstance()) | ||
loadDBNotStrict(t, rclient, v) | ||
rclient.Close() | ||
} | ||
|
@@ -1208,7 +1208,7 @@ func runGnmiTestGet(t *testing.T, namespace string) { | |
|
||
stateDBPath := "STATE_DB" | ||
|
||
if namespace != sdcfg.GetDbDefaultNamespace() { | ||
if namespace != sdcfg.GetDbDefaultInstance() { | ||
stateDBPath = "STATE_DB" + "/" + namespace | ||
} | ||
|
||
|
@@ -1444,9 +1444,9 @@ func TestGnmiGet(t *testing.T) { | |
s := createServer(t, 8081) | ||
go runServer(t, s) | ||
|
||
prepareDb(t, sdcfg.GetDbDefaultNamespace()) | ||
prepareDb(t, sdcfg.GetDbDefaultInstance()) | ||
|
||
runGnmiTestGet(t, sdcfg.GetDbDefaultNamespace()) | ||
runGnmiTestGet(t, sdcfg.GetDbDefaultInstance()) | ||
|
||
s.s.Stop() | ||
} | ||
|
@@ -2715,7 +2715,7 @@ func TestGnmiSubscribe(t *testing.T) { | |
s := createServer(t, 8081) | ||
go runServer(t, s) | ||
|
||
runTestSubscribe(t, sdcfg.GetDbDefaultNamespace()) | ||
runTestSubscribe(t, sdcfg.GetDbDefaultInstance()) | ||
|
||
s.s.Stop() | ||
} | ||
|
@@ -3125,7 +3125,7 @@ func TestTableKeyOnDeletion(t *testing.T) { | |
var neighStateTableDeletedJson61 interface{} | ||
json.Unmarshal(neighStateTableDeletedByte61, &neighStateTableDeletedJson61) | ||
|
||
namespace := sdcfg.GetDbDefaultNamespace() | ||
namespace := sdcfg.GetDbDefaultInstance() | ||
rclient := getRedisClientN(t, 6, namespace) | ||
defer rclient.Close() | ||
prepareStateDb(t, namespace) | ||
|
@@ -3411,7 +3411,7 @@ func TestConnectionDataSet(t *testing.T) { | |
}, | ||
}, | ||
} | ||
namespace := sdcfg.GetDbDefaultNamespace() | ||
namespace := sdcfg.GetDbDefaultInstance() | ||
rclient := getRedisClientN(t, 6, namespace) | ||
defer rclient.Close() | ||
|
||
|
@@ -3777,7 +3777,7 @@ print('%s') | |
pathTarget: "", | ||
textPbPath: ` | ||
origin: "sonic-db", | ||
elem: <name: "APPL_DB" > elem:<name:"DASH_QOS" > | ||
elem: <name: "APPL_DB" > elem: <name: "localhost" > elem:<name:"DASH_QOS" > | ||
`, | ||
attributeData: "../testdata/batch.txt", | ||
wantRetCode: codes.OK, | ||
|
@@ -3828,14 +3828,14 @@ print('%s') | |
s := createServer(t, 8080) | ||
go runServer(t, s) | ||
defer s.s.Stop() | ||
initFullConfigDb(t, sdcfg.GetDbDefaultNamespace()) | ||
initFullCountersDb(t, sdcfg.GetDbDefaultNamespace()) | ||
initFullConfigDb(t, sdcfg.GetDbDefaultInstance()) | ||
initFullCountersDb(t, sdcfg.GetDbDefaultInstance()) | ||
|
||
path, _ := os.Getwd() | ||
path = filepath.Dir(path) | ||
|
||
var cmd *exec.Cmd | ||
cmd = exec.Command("bash", "-c", "cd "+path+" && "+"pytest") | ||
cmd = exec.Command("bash", "-c", "cd "+path+" && "+"pytest -m 'not dpu'") | ||
if result, err := cmd.Output(); err != nil { | ||
fmt.Println(string(result)) | ||
t.Errorf("Fail to execute pytest: %v", err) | ||
|
@@ -3861,6 +3861,41 @@ print('%s') | |
s.s.Stop() | ||
} | ||
|
||
// Test DPU configuration with multiple databases | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also generalize the PR title? |
||
func TestGNMINativeDPU(t *testing.T) { | ||
sdcfg.Init() | ||
err := test_utils.SetupMultiDPU() | ||
if err != nil { | ||
t.Fatalf("error Setting up MultiDPU files with err %T", err) | ||
} | ||
|
||
/* https://www.gopherguides.com/articles/test-cleanup-in-go-1-14*/ | ||
t.Cleanup(func() { | ||
if err := test_utils.CleanUpMultiDPU(); err != nil { | ||
t.Fatalf("error Cleaning up MultiDPU files with err %T", err) | ||
|
||
} | ||
}) | ||
|
||
s := createServer(t, 8080) | ||
go runServer(t, s) | ||
defer s.s.Stop() | ||
initFullConfigDb(t, sdcfg.GetDbDefaultInstance()) | ||
initFullCountersDb(t, sdcfg.GetDbDefaultInstance()) | ||
|
||
path, _ := os.Getwd() | ||
path = filepath.Dir(path) | ||
|
||
var cmd *exec.Cmd | ||
cmd = exec.Command("bash", "-c", "cd "+path+" && "+"pytest -m 'dpu'") | ||
if result, err := cmd.Output(); err != nil { | ||
fmt.Println(string(result)) | ||
t.Errorf("Fail to execute pytest: %v", err) | ||
} else { | ||
fmt.Println(string(result)) | ||
} | ||
} | ||
|
||
func TestServerPort(t *testing.T) { | ||
s := createServer(t, -8080) | ||
port := s.Port() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[pytest] | ||
markers: | ||
dpu | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some comment to explain the intention? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated