Skip to content

Commit

Permalink
Use kotsadm/rqlite image in migrations test (#4227)
Browse files Browse the repository at this point in the history
* Use kotsadm/rqlite image in migrations test
  • Loading branch information
sgalsaleh authored Dec 15, 2023
1 parent 4a9cbdd commit ec37bb7
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions integration/database/rqlite_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"database/sql"
_ "embed"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"os/user"
"path"
"testing"

Expand Down Expand Up @@ -63,19 +64,27 @@ func TestMigrateFromPostgresToRqlite(t *testing.T) {
}

// start rqlite db
rqliteAuthConfigPath := path.Join(t.TempDir(), "rqlite-auth-config.json")
err = ioutil.WriteFile(rqliteAuthConfigPath, []byte(RQLITE_AUTH_CONFIG), 0644)
currentUser, err := user.Current()
if err != nil {
log.Fatalf("Failed to get current user: %s", err)
}
rqliteAuthConfigPath := path.Join(t.TempDir(), "rqlite-auth-config.json")
if err := os.WriteFile(rqliteAuthConfigPath, []byte(RQLITE_AUTH_CONFIG), 0644); err != nil {
t.Fatalf("Failed to write to file %s", rqliteAuthConfigPath)
}
rqliteTag, _ := image.GetTag(image.Rqlite)
rqliteRunOptions := &dockertest.RunOptions{
Name: "rqlite",
Repository: "rqlite/rqlite",
Repository: "kotsadm/rqlite",
Tag: rqliteTag,
Mounts: []string{
fmt.Sprintf("%s:/rqlite/file", t.TempDir()),
fmt.Sprintf("%s:/auth/config.json", rqliteAuthConfigPath),
},
ExposedPorts: []string{
"4001/tcp",
"4002/tcp",
},
PortBindings: map[docker.Port][]docker.PortBinding{
"4001/tcp": {
{
Expand All @@ -88,6 +97,7 @@ func TestMigrateFromPostgresToRqlite(t *testing.T) {
"-http-adv-addr=localhost:14001",
"-auth=/auth/config.json",
},
User: currentUser.Uid,
}
rqliteHostConfig := func(config *docker.HostConfig) {
config.AutoRemove = true
Expand Down

0 comments on commit ec37bb7

Please sign in to comment.