Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions pkg/dotc1z/c1file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func TestC1Z(t *testing.T) {
testFilePath := filepath.Join(c1zTests.workingDir, "test.c1z")

var opts []C1ZOption
opts = append(opts, WithPragma("journal_mode", "WAL"))

// Open file
f, err := NewC1ZFile(ctx, testFilePath, opts...)
Expand Down Expand Up @@ -164,7 +163,7 @@ func TestC1ZDecoder(t *testing.T) {
testFilePath := filepath.Join(c1zTests.workingDir, "test-decoder.c1z")

// Open file
f, err := NewC1ZFile(ctx, testFilePath, WithPragma("journal_mode", "WAL"))
f, err := NewC1ZFile(ctx, testFilePath)
require.NoError(t, err)

// Start a new sync
Expand Down Expand Up @@ -268,7 +267,7 @@ func TestCurrentDBSizeBytes(t *testing.T) {
ctx := t.Context()
testFilePath := filepath.Join(c1zTests.workingDir, "test-currentdbsize.c1z")

f, err := NewC1ZFile(ctx, testFilePath, WithPragma("journal_mode", "WAL"))
f, err := NewC1ZFile(ctx, testFilePath)
require.NoError(t, err)
defer func() { _ = f.Close(ctx) }()

Expand Down Expand Up @@ -354,15 +353,15 @@ func TestC1ZInvalidFile(t *testing.T) {
err = f.Close()
require.NoError(t, err)

_, err = NewC1ZFile(ctx, testFilePath, WithPragma("journal_mode", "WAL"))
_, err = NewC1ZFile(ctx, testFilePath)
require.ErrorIs(t, err, ErrInvalidFile)
}

func TestC1ZStats(t *testing.T) {
ctx := t.Context()
testFilePath := filepath.Join(c1zTests.workingDir, "test-stats.c1z")

f, err := NewC1ZFile(ctx, testFilePath, WithPragma("journal_mode", "WAL"))
f, err := NewC1ZFile(ctx, testFilePath)
require.NoError(t, err)

syncID, err := f.StartNewSync(ctx, connectorstore.SyncTypeFull, "")
Expand Down Expand Up @@ -413,7 +412,7 @@ func TestC1ZStatsPartialSync(t *testing.T) {
ctx := t.Context()
testFilePath := filepath.Join(c1zTests.workingDir, "test-stats-partial-sync.c1z")

f, err := NewC1ZFile(ctx, testFilePath, WithPragma("journal_mode", "WAL"))
f, err := NewC1ZFile(ctx, testFilePath)
require.NoError(t, err)

syncID, err := f.StartNewSync(ctx, connectorstore.SyncTypePartial, "")
Expand Down Expand Up @@ -453,7 +452,7 @@ func TestC1ZStatsResourcesOnlySync(t *testing.T) {
ctx := t.Context()
testFilePath := filepath.Join(c1zTests.workingDir, "test-stats-resources-only-sync.c1z")

f, err := NewC1ZFile(ctx, testFilePath, WithPragma("journal_mode", "WAL"))
f, err := NewC1ZFile(ctx, testFilePath)
require.NoError(t, err)

syncID, err := f.StartNewSync(ctx, connectorstore.SyncTypeResourcesOnly, "")
Expand Down Expand Up @@ -509,7 +508,7 @@ func TestC1ZGrantStatsSync(t *testing.T) {

testFilePath := filepath.Join(c1zTests.workingDir, "test-grant-stats-sync.c1z")

f, err := NewC1ZFile(ctx, testFilePath, WithPragma("journal_mode", "WAL"))
f, err := NewC1ZFile(ctx, testFilePath)
require.NoError(t, err)

syncID, err := f.StartNewSync(ctx, connectorstore.SyncTypePartial, "")
Expand Down Expand Up @@ -628,7 +627,7 @@ func TestC1ZCachedViewSyncRunInvalidation(t *testing.T) {
ctx := t.Context()
testFilePath := filepath.Join(c1zTests.workingDir, "test-cached-view-sync-invalidation.c1z")

f, err := NewC1ZFile(ctx, testFilePath, WithPragma("journal_mode", "WAL"))
f, err := NewC1ZFile(ctx, testFilePath)
require.NoError(t, err)

// Start first sync and add a resource
Expand Down
26 changes: 13 additions & 13 deletions pkg/dotc1z/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestGenerateSyncDiff(t *testing.T) {
filePath := filepath.Join(c1zTests.workingDir, "diff_additions.c1z")

// Create the base C1Z file
syncFile, err := NewC1ZFile(ctx, filePath, WithPragma("journal_mode", "WAL"))
syncFile, err := NewC1ZFile(ctx, filePath)
require.NoError(t, err)
defer syncFile.Close(ctx)

Expand Down Expand Up @@ -112,7 +112,7 @@ func TestGenerateSyncDiffFromFile_Additions(t *testing.T) {
defer os.Remove(oldPath)
defer os.Remove(newPath)

opts := []C1ZOption{WithPragma("journal_mode", "WAL")}
opts := []C1ZOption{}

// Create the OLD file with one resource.
// We're attaching this later, so don't use an exclusive lock.
Expand Down Expand Up @@ -241,7 +241,7 @@ func TestGenerateSyncDiffFromFile_Deletions(t *testing.T) {
defer os.Remove(oldPath)
defer os.Remove(newPath)

opts := []C1ZOption{WithPragma("journal_mode", "WAL")}
opts := []C1ZOption{}

// Create the OLD file with two resources
oldOpts := append(slices.Clone(opts), WithPragma("locking_mode", "normal"))
Expand Down Expand Up @@ -345,7 +345,7 @@ func TestGenerateSyncDiffFromFile_Modifications(t *testing.T) {
defer os.Remove(oldPath)
defer os.Remove(newPath)

opts := []C1ZOption{WithPragma("journal_mode", "WAL")}
opts := []C1ZOption{}

// Create the OLD file with a resource
oldOpts := append(slices.Clone(opts), WithPragma("locking_mode", "normal"))
Expand Down Expand Up @@ -441,7 +441,7 @@ func TestGenerateSyncDiffFromFile_MixedChanges(t *testing.T) {
defer os.Remove(oldPath)
defer os.Remove(newPath)

opts := []C1ZOption{WithPragma("journal_mode", "WAL")}
opts := []C1ZOption{}
resourceTypeID := testResourceType

// Create OLD file with resources A, B, C
Expand Down Expand Up @@ -574,7 +574,7 @@ func TestGenerateSyncDiffFromFile_NoChanges(t *testing.T) {
defer os.Remove(oldPath)
defer os.Remove(newPath)

opts := []C1ZOption{WithPragma("journal_mode", "WAL")}
opts := []C1ZOption{}
resourceTypeID := testResourceType

// Create OLD file with resource A
Expand Down Expand Up @@ -668,7 +668,7 @@ func TestGenerateSyncDiffFromFile_EntitlementsOnly(t *testing.T) {
defer os.Remove(oldPath)
defer os.Remove(newPath)

opts := []C1ZOption{WithPragma("journal_mode", "WAL")}
opts := []C1ZOption{}
resourceTypeID := testResourceType

// Create OLD file with entitlement A
Expand Down Expand Up @@ -777,7 +777,7 @@ func TestGenerateSyncDiffFromFile_GrantsOnly(t *testing.T) {
defer os.Remove(oldPath)
defer os.Remove(newPath)

opts := []C1ZOption{WithPragma("journal_mode", "WAL")}
opts := []C1ZOption{}
resourceTypeID := testResourceType

// Create OLD file with grant A
Expand Down Expand Up @@ -910,7 +910,7 @@ func TestGenerateSyncDiffFromFile_EmptyBase(t *testing.T) {
defer os.Remove(oldPath)
defer os.Remove(newPath)

opts := []C1ZOption{WithPragma("journal_mode", "WAL")}
opts := []C1ZOption{}
resourceTypeID := testResourceType

// Create OLD file with empty sync (no resources)
Expand Down Expand Up @@ -1014,7 +1014,7 @@ func TestGenerateSyncDiffFromFile_EmptyNew(t *testing.T) {
defer os.Remove(oldPath)
defer os.Remove(newPath)

opts := []C1ZOption{WithPragma("journal_mode", "WAL")}
opts := []C1ZOption{}
resourceTypeID := testResourceType

// Create OLD file with resources A and B
Expand Down Expand Up @@ -1118,7 +1118,7 @@ func TestGenerateSyncDiffFromFile_EntitlementsDeletions(t *testing.T) {
defer os.Remove(oldPath)
defer os.Remove(newPath)

opts := []C1ZOption{WithPragma("journal_mode", "WAL")}
opts := []C1ZOption{}
resourceTypeID := testResourceType

// Create OLD file with entitlements A and B
Expand Down Expand Up @@ -1227,7 +1227,7 @@ func TestGenerateSyncDiffFromFile_EntitlementsModifications(t *testing.T) {
defer os.Remove(oldPath)
defer os.Remove(newPath)

opts := []C1ZOption{WithPragma("journal_mode", "WAL")}
opts := []C1ZOption{}
resourceTypeID := testResourceType

// Create OLD file with entitlement A
Expand Down Expand Up @@ -1325,7 +1325,7 @@ func TestGenerateSyncDiffFromFile_GrantsDeletions(t *testing.T) {
defer os.Remove(oldPath)
defer os.Remove(newPath)

opts := []C1ZOption{WithPragma("journal_mode", "WAL")}
opts := []C1ZOption{}
resourceTypeID := testResourceType

// Create OLD file with grants A and B
Expand Down
1 change: 0 additions & 1 deletion pkg/dotc1z/grant_stats_groupby_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func runGrantStatsParityCase(t *testing.T, numResourceTypes, grantsPerSync, numS
testFilePath := filepath.Join(tempDir, "parity.c1z")
f, err := NewC1ZFile(ctx, testFilePath,
WithTmpDir(tempDir),
WithPragma("journal_mode", "WAL"),
)
require.NoError(t, err)
t.Cleanup(func() { _ = f.Close(ctx) })
Expand Down
4 changes: 2 additions & 2 deletions pkg/dotc1z/grants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func TestDiffDetectsExpansionAnnotationChange(t *testing.T) {
defer os.Remove(oldPath)
defer os.Remove(newPath)

opts := []C1ZOption{WithPragma("journal_mode", "WAL")}
opts := []C1ZOption{}

groupRT := v2.ResourceType_builder{Id: "group", DisplayName: "Group"}.Build()
userRT := v2.ResourceType_builder{Id: "user", DisplayName: "User"}.Build()
Expand Down Expand Up @@ -354,7 +354,7 @@ func TestDiffDetectsDataOnlyChange(t *testing.T) {
defer os.Remove(oldPath)
defer os.Remove(newPath)

opts := []C1ZOption{WithPragma("journal_mode", "WAL")}
opts := []C1ZOption{}

groupRT := v2.ResourceType_builder{Id: "group", DisplayName: "Group"}.Build()
userRT := v2.ResourceType_builder{Id: "user", DisplayName: "User"}.Build()
Expand Down
22 changes: 11 additions & 11 deletions pkg/dotc1z/session_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestC1FileSessionStore_Get(t *testing.T) {
ctx := t.Context()
tempDir := filepath.Join(t.TempDir(), "test-session.c1z")

c1zFile, err := NewC1ZFile(ctx, tempDir, WithPragma("journal_mode", "WAL"))
c1zFile, err := NewC1ZFile(ctx, tempDir)
require.NoError(t, err)
defer c1zFile.Close(ctx)

Expand Down Expand Up @@ -76,7 +76,7 @@ func TestC1FileSessionStore_Set(t *testing.T) {
ctx := t.Context()
tempDir := filepath.Join(t.TempDir(), "test-session.c1z")

c1zFile, err := NewC1ZFile(ctx, tempDir, WithPragma("journal_mode", "WAL"))
c1zFile, err := NewC1ZFile(ctx, tempDir)
require.NoError(t, err)
defer c1zFile.Close(ctx)

Expand Down Expand Up @@ -144,7 +144,7 @@ func TestC1FileSessionStore_GetMany(t *testing.T) {
ctx := t.Context()
tempDir := filepath.Join(t.TempDir(), "test-session.c1z")

c1zFile, err := NewC1ZFile(ctx, tempDir, WithPragma("journal_mode", "WAL"))
c1zFile, err := NewC1ZFile(ctx, tempDir)
require.NoError(t, err)
defer c1zFile.Close(ctx)

Expand Down Expand Up @@ -473,7 +473,7 @@ func TestC1FileSessionStore_SetMany(t *testing.T) {
ctx := t.Context()
tempDir := filepath.Join(t.TempDir(), "test-session.c1z")

c1zFile, err := NewC1ZFile(ctx, tempDir, WithPragma("journal_mode", "WAL"))
c1zFile, err := NewC1ZFile(ctx, tempDir)
require.NoError(t, err)
defer c1zFile.Close(ctx)

Expand Down Expand Up @@ -554,7 +554,7 @@ func TestC1FileSessionStore_Delete(t *testing.T) {
ctx := t.Context()
tempDir := filepath.Join(t.TempDir(), "test-session.c1z")

c1zFile, err := NewC1ZFile(ctx, tempDir, WithPragma("journal_mode", "WAL"))
c1zFile, err := NewC1ZFile(ctx, tempDir)
require.NoError(t, err)
defer c1zFile.Close(ctx)

Expand Down Expand Up @@ -625,7 +625,7 @@ func TestC1FileSessionStore_Clear(t *testing.T) {
ctx := t.Context()
tempDir := filepath.Join(t.TempDir(), "test-session.c1z")

c1zFile, err := NewC1ZFile(ctx, tempDir, WithPragma("journal_mode", "WAL"))
c1zFile, err := NewC1ZFile(ctx, tempDir)
require.NoError(t, err)
defer c1zFile.Close(ctx)

Expand Down Expand Up @@ -766,7 +766,7 @@ func TestC1FileSessionStore_GetAll(t *testing.T) {
ctx := t.Context()
tempDir := filepath.Join(t.TempDir(), "test-session.c1z")

c1zFile, err := NewC1ZFile(ctx, tempDir, WithPragma("journal_mode", "WAL"))
c1zFile, err := NewC1ZFile(ctx, tempDir)
require.NoError(t, err)
defer c1zFile.Close(ctx)

Expand Down Expand Up @@ -1742,7 +1742,7 @@ func TestC1FileSessionStore_Isolation(t *testing.T) {
ctx := t.Context()
tempDir := filepath.Join(t.TempDir(), "test-session.c1z")

c1zFile, err := NewC1ZFile(ctx, tempDir, WithPragma("journal_mode", "WAL"))
c1zFile, err := NewC1ZFile(ctx, tempDir)
require.NoError(t, err)
defer c1zFile.Close(ctx)

Expand Down Expand Up @@ -1809,7 +1809,7 @@ func TestC1FileSessionStore_ConcurrentAccess(t *testing.T) {
ctx := t.Context()
tempDir := filepath.Join(t.TempDir(), "test-session.c1z")

c1zFile, err := NewC1ZFile(ctx, tempDir, WithPragma("journal_mode", "WAL"), WithPragma("main.locking_mode", "NORMAL"))
c1zFile, err := NewC1ZFile(ctx, tempDir, WithPragma("main.locking_mode", "NORMAL"))
require.NoError(t, err)
defer c1zFile.Close(ctx)

Expand Down Expand Up @@ -1862,7 +1862,7 @@ func TestC1FileSessionStore_ErrorHandling(t *testing.T) {
ctx := t.Context()
tempDir := filepath.Join(t.TempDir(), "test-session.c1z")

c1zFile, err := NewC1ZFile(ctx, tempDir, WithPragma("journal_mode", "WAL"))
c1zFile, err := NewC1ZFile(ctx, tempDir)
require.NoError(t, err)
defer c1zFile.Close(ctx)

Expand Down Expand Up @@ -1894,7 +1894,7 @@ func TestC1FileSessionStore_Performance(t *testing.T) {
ctx := t.Context()
tempDir := filepath.Join(t.TempDir(), "test-session.c1z")

c1zFile, err := NewC1ZFile(ctx, tempDir, WithPragma("journal_mode", "WAL"))
c1zFile, err := NewC1ZFile(ctx, tempDir)
require.NoError(t, err)
defer c1zFile.Close(ctx)

Expand Down
8 changes: 4 additions & 4 deletions pkg/dotc1z/sql_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestPutResources(t *testing.T) {

tempDir := filepath.Join(t.TempDir(), "test.c1z")

c1zFile, err := NewC1ZFile(ctx, tempDir, WithPragma("journal_mode", "WAL"))
c1zFile, err := NewC1ZFile(ctx, tempDir)
require.NoError(t, err)

syncId, err := c1zFile.StartNewSync(ctx, connectorstore.SyncTypeFull, "")
Expand Down Expand Up @@ -94,7 +94,7 @@ func TestListResources(t *testing.T) {

tempDir := filepath.Join(t.TempDir(), "test.c1z")

c1zFile, err := NewC1ZFile(ctx, tempDir, WithPragma("journal_mode", "WAL"))
c1zFile, err := NewC1ZFile(ctx, tempDir)
require.NoError(t, err)
defer func() {
err := c1zFile.Close(ctx)
Expand Down Expand Up @@ -183,7 +183,7 @@ func TestListResourcesWithParentFilter(t *testing.T) {

tempDir := filepath.Join(t.TempDir(), "test.c1z")

c1zFile, err := NewC1ZFile(ctx, tempDir, WithPragma("journal_mode", "WAL"))
c1zFile, err := NewC1ZFile(ctx, tempDir)
require.NoError(t, err)
defer func() {
err := c1zFile.Close(ctx)
Expand Down Expand Up @@ -361,7 +361,7 @@ func BenchmarkPutResources(b *testing.B) {

tempDir := filepath.Join(b.TempDir(), "test.c1z")

c1zFile, err := NewC1ZFile(ctx, tempDir, WithPragma("journal_mode", "WAL"))
c1zFile, err := NewC1ZFile(ctx, tempDir)
require.NoError(b, err)

_, err = c1zFile.StartNewSync(ctx, connectorstore.SyncTypeFull, "")
Expand Down
2 changes: 1 addition & 1 deletion pkg/dotc1z/sync_runs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestCleanupVacuumWAL(t *testing.T) {

testFilePath := filepath.Join(tmpDir, "test.c1z")

f, err := dotc1z.NewC1ZFile(ctx, testFilePath, dotc1z.WithPragma("journal_mode", "WAL"))
f, err := dotc1z.NewC1ZFile(ctx, testFilePath)
require.NoError(t, err)

_, err = c1ztest.CreateTestSync(ctx, t, f, c1ztest.C1ZCounts{
Expand Down
1 change: 0 additions & 1 deletion pkg/synccompactor/attached/attached_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ func TestAttachedCompactorDoesNotOperateOnDiffSyncTypes(t *testing.T) {
tmpDir := t.TempDir()

opts := []dotc1z.C1ZOption{
dotc1z.WithPragma("journal_mode", "WAL"),
dotc1z.WithTmpDir(tmpDir),
}

Expand Down
1 change: 0 additions & 1 deletion pkg/synccompactor/attached/comprehensive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ func TestCompactionPreservesGrantExpansionColumns(t *testing.T) {
tmpDir := t.TempDir()

opts := []dotc1z.C1ZOption{
dotc1z.WithPragma("journal_mode", "WAL"),
dotc1z.WithTmpDir(tmpDir),
}

Expand Down
2 changes: 0 additions & 2 deletions pkg/synccompactor/attached/timestamp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func TestDiscoveredAtMergeLogic(t *testing.T) {
appliedFile := filepath.Join(tmpDir, "applied.c1z")

opts := []dotc1z.C1ZOption{
dotc1z.WithPragma("journal_mode", "WAL"),
dotc1z.WithTmpDir(tmpDir),
}

Expand Down Expand Up @@ -104,7 +103,6 @@ func TestDiscoveredAtMergeLogic(t *testing.T) {
appliedFile := filepath.Join(tmpDir, "applied.c1z")

opts := []dotc1z.C1ZOption{
dotc1z.WithPragma("journal_mode", "WAL"),
dotc1z.WithTmpDir(tmpDir),
}

Expand Down
Loading
Loading