mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-11 03:11:50 +00:00
fix: Add ssdb environment preparation
Change-Id: I8534e66786021ce4384c92a2a8d14aa50839a4da
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user