diff --git a/database/ssdb/database_test.go b/database/ssdb/database_test.go index d6257015b..139432bfd 100644 --- a/database/ssdb/database_test.go +++ b/database/ssdb/database_test.go @@ -2,6 +2,9 @@ package ssdb_test import ( "fmt" + "io/ioutil" + "os" + "os/exec" "testing" "github.com/aptly-dev/aptly/database" @@ -15,6 +18,44 @@ func Test(t *testing.T) { TestingT(t) } +func setUpSsdb() error { + setUpStr := ` + #!/bin/bash + if [ ! -e /tmp/ssdb-master/ssdb-master ]; then + mkdir -p /tmp/ssdb-master + wget --no-check-certificate https://github.com/ideawu/ssdb/archive/master.zip -O /tmp/ssdb-master/master.zip + cd /tmp/ssdb-master && unzip master && cd ssdb-master && make all + fi + cd /tmp/ssdb-master/ssdb-master && ./ssdb-server -d ssdb.conf -s restart + sleep 2` + + tmpShell, err := ioutil.TempFile("/tmp", "ssdbSetup") + if err != nil { + return err + } + defer os.Remove(tmpShell.Name()) + + _, err = tmpShell.WriteString(setUpStr) + if err != nil { + return err + } + + cmd := exec.Command("/bin/bash", tmpShell.Name()) + fmt.Println(cmd.String()) + output, err := cmd.Output() + fmt.Println(string(output)) + if err != nil { + return err + } + + return nil +} + +func TestMain(m *testing.M) { + setUpSsdb() + m.Run() +} + type SSDBSuite struct { cfg *conf.Config db database.Storage diff --git a/system/t02_config/ConfigShowTest_gold b/system/t02_config/ConfigShowTest_gold index 57b42b6aa..05ecd2391 100644 --- a/system/t02_config/ConfigShowTest_gold +++ b/system/t02_config/ConfigShowTest_gold @@ -25,5 +25,10 @@ "SwiftPublishEndpoints": {}, "AzurePublishEndpoints": {}, "AsyncAPI": false, - "enableMetricsEndpoint": true + "enableMetricsEndpoint": true, + "databaseBackend": { + "type": "", + "url": "", + "dbPath": "" + } } diff --git a/system/t02_config/CreateConfigTest_gold b/system/t02_config/CreateConfigTest_gold index 7d1a23e16..a43a559e2 100644 --- a/system/t02_config/CreateConfigTest_gold +++ b/system/t02_config/CreateConfigTest_gold @@ -25,5 +25,10 @@ "SwiftPublishEndpoints": {}, "AzurePublishEndpoints": {}, "AsyncAPI": false, - "enableMetricsEndpoint": false + "enableMetricsEndpoint": false, + "databaseBackend": { + "type": "", + "url": "", + "dbPath": "" + } } \ No newline at end of file