File tree Expand file tree Collapse file tree 3 files changed +53
-2
lines changed
Expand file tree Collapse file tree 3 files changed +53
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ package ssdb_test
22
33import (
44 "fmt"
5+ "io/ioutil"
6+ "os"
7+ "os/exec"
58 "testing"
69
710 "github.com/aptly-dev/aptly/database"
@@ -15,6 +18,44 @@ func Test(t *testing.T) {
1518 TestingT (t )
1619}
1720
21+ func setUpSsdb () error {
22+ setUpStr := `
23+ #!/bin/bash
24+ if [ ! -e /tmp/ssdb-master/ssdb-master ]; then
25+ mkdir -p /tmp/ssdb-master
26+ wget --no-check-certificate https://github.com/ideawu/ssdb/archive/master.zip -O /tmp/ssdb-master/master.zip
27+ cd /tmp/ssdb-master && unzip master && cd ssdb-master && make all
28+ fi
29+ cd /tmp/ssdb-master/ssdb-master && ./ssdb-server -d ssdb.conf -s restart
30+ sleep 2`
31+
32+ tmpShell , err := ioutil .TempFile ("/tmp" , "ssdbSetup" )
33+ if err != nil {
34+ return err
35+ }
36+ defer os .Remove (tmpShell .Name ())
37+
38+ _ , err = tmpShell .WriteString (setUpStr )
39+ if err != nil {
40+ return err
41+ }
42+
43+ cmd := exec .Command ("/bin/bash" , tmpShell .Name ())
44+ fmt .Println (cmd .String ())
45+ output , err := cmd .Output ()
46+ fmt .Println (string (output ))
47+ if err != nil {
48+ return err
49+ }
50+
51+ return nil
52+ }
53+
54+ func TestMain (m * testing.M ) {
55+ setUpSsdb ()
56+ m .Run ()
57+ }
58+
1859type SSDBSuite struct {
1960 cfg * conf.Config
2061 db database.Storage
Original file line number Diff line number Diff line change 2525 "SwiftPublishEndpoints": {},
2626 "AzurePublishEndpoints": {},
2727 "AsyncAPI": false,
28- "enableMetricsEndpoint": true
28+ "enableMetricsEndpoint": true,
29+ "databaseBackend": {
30+ "type": "",
31+ "url": "",
32+ "dbPath": ""
33+ }
2934}
Original file line number Diff line number Diff line change 2525 "SwiftPublishEndpoints": {},
2626 "AzurePublishEndpoints": {},
2727 "AsyncAPI": false,
28- "enableMetricsEndpoint": false
28+ "enableMetricsEndpoint": false,
29+ "databaseBackend": {
30+ "type": "",
31+ "url": "",
32+ "dbPath": ""
33+ }
2934}
You can’t perform that action at this time.
0 commit comments