diff --git a/internal/api/rust/rust.go b/internal/api/rust/rust.go index db6ad14..14eea26 100644 --- a/internal/api/rust/rust.go +++ b/internal/api/rust/rust.go @@ -16,11 +16,11 @@ import ( "golang.org/x/exp/slices" ) -func DeleteOldLogs() { +func DeleteOldLogs(prefix string) { // delete old log files files, _ := os.ReadDir("./logs") for _, f := range files { - if strings.HasPrefix(f.Name(), "rust_sdk_logs") { + if strings.HasPrefix(f.Name(), prefix) { os.Remove(filepath.Join("./logs", f.Name())) } } diff --git a/tests/go_templates/testRoomKeyIsNotCycledOnClientRestartRust/test.go b/tests/go_templates/testRoomKeyIsNotCycledOnClientRestartRust/test.go index 72f3197..7623214 100644 --- a/tests/go_templates/testRoomKeyIsNotCycledOnClientRestartRust/test.go +++ b/tests/go_templates/testRoomKeyIsNotCycledOnClientRestartRust/test.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "strings" "time" "github.com/matrix-org/complement-crypto/internal/api" @@ -17,7 +18,7 @@ func main() { DeviceID: "{{.DeviceID}}", Password: "{{.Password}}", SlidingSyncURL: "{{.SSURL}}", - PersistentStorage: {{.PersistentStorage}}, + PersistentStorage: strings.EqualFold("{{.PersistentStorage}}", "true"), } client, err := rust.NewRustClient(t, cfg) if err != nil { diff --git a/tests/go_templates/testSigkillBeforeKeysUploadResponseRust/test.go b/tests/go_templates/testSigkillBeforeKeysUploadResponseRust/test.go index 250b75b..377e2fc 100644 --- a/tests/go_templates/testSigkillBeforeKeysUploadResponseRust/test.go +++ b/tests/go_templates/testSigkillBeforeKeysUploadResponseRust/test.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "strings" "time" "github.com/matrix-org/complement-crypto/internal/api" @@ -18,7 +19,7 @@ func main() { DeviceID: "{{.DeviceID}}", Password: "{{.Password}}", SlidingSyncURL: "{{.SSURL}}", - PersistentStorage: {{.PersistentStorage}}, + PersistentStorage: strings.EqualFold("{{.PersistentStorage}}", "true"), } client, err := rust.NewRustClient(t, cfg) if err != nil { diff --git a/tests/go_templates/testUnprocessedToDeviceMessagesArentLostOnRestartRust/test.go b/tests/go_templates/testUnprocessedToDeviceMessagesArentLostOnRestartRust/test.go index 9c026f3..7892cd6 100644 --- a/tests/go_templates/testUnprocessedToDeviceMessagesArentLostOnRestartRust/test.go +++ b/tests/go_templates/testUnprocessedToDeviceMessagesArentLostOnRestartRust/test.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "strings" "time" "github.com/matrix-org/complement-crypto/internal/api" @@ -18,7 +19,7 @@ func main() { DeviceID: "{{.DeviceID}}", Password: "{{.Password}}", SlidingSyncURL: "{{.SSURL}}", - PersistentStorage: {{.PersistentStorage}}, + PersistentStorage: strings.EqualFold("{{.PersistentStorage}}", "true"), } client, err := rust.NewRustClient(t, cfg) if err != nil { diff --git a/tests/main_test.go b/tests/main_test.go index 135d062..9073e5a 100644 --- a/tests/main_test.go +++ b/tests/main_test.go @@ -35,7 +35,8 @@ func TestMain(m *testing.M) { // TODO: ideally client packages would do this. os.RemoveAll("./rust_storage") os.RemoveAll("./chromedp") - rust.DeleteOldLogs() + rust.DeleteOldLogs("rust_sdk_logs") + rust.DeleteOldLogs("rust_sdk_inline_script") rust.SetupLogs("rust_sdk_logs") js.SetupJSLogs("./logs/js_sdk.log") // rust sdk logs on its own