Remove loading env from tests. (#988)
* Remove loading env from tests. * Rollback the test workflow.
This commit is contained in:
parent
10e9e354b5
commit
eab10af4a3
|
@ -1,10 +1,7 @@
|
|||
package migrations_test
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"math"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -15,23 +12,6 @@ import (
|
|||
)
|
||||
|
||||
func TestExifMigration(t *testing.T) {
|
||||
envFile, err := os.Open("/home/runner/work/photoview/photoview/api/testing.env")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to open environment file: %v", err)
|
||||
}
|
||||
defer envFile.Close()
|
||||
|
||||
scanner := bufio.NewScanner(envFile)
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
parts := strings.SplitN(line, "=", 2)
|
||||
if len(parts) != 2 {
|
||||
t.Fatalf("Invalid line in environment file: %s", line)
|
||||
}
|
||||
key, value := parts[0], strings.Trim(parts[1], "'")
|
||||
os.Setenv(key, value)
|
||||
}
|
||||
|
||||
db := test_utils.DatabaseTest(t)
|
||||
defer db.Exec("DELETE FROM media_exif") // Clean up after test
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package migrations_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/photoview/photoview/api/test_utils"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
os.Exit(test_utils.IntegrationTestRun(m))
|
||||
}
|
Loading…
Reference in New Issue