Skip to content

Commit a4d7160

Browse files
committed
update TestScanAndFill() to scan over existing files
1 parent 4e87b60 commit a4d7160

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

services/galexie/internal/integration_test.go

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/stretchr/testify/suite"
2424

2525
"github.com/fsouza/fake-gcs-server/fakestorage"
26+
2627
"github.com/stellar/go/historyarchive"
2728
"github.com/stellar/go/support/datastore"
2829
"github.com/stellar/go/support/storage"
@@ -100,6 +101,28 @@ func (s *GalexieTestSuite) TestScanAndFill() {
100101

101102
_, err = datastore.GetFile(s.ctx, "FFFFFFFF--0-9/FFFFFFFA--5.xdr.zstd")
102103
require.NoError(err)
104+
105+
lastModified, err := datastore.GetFileLastModified(s.ctx, "FFFFFFFF--0-9/FFFFFFFA--5.xdr.zstd")
106+
require.NoError(err)
107+
108+
// now run an scan-and-fill on an overlapping range, it will skip over existing ledgers
109+
rootCmd.SetArgs([]string{"scan-and-fill", "--start", "4", "--end", "9", "--config-file", s.tempConfigFile})
110+
errWriter.Reset()
111+
rootCmd.SetErr(&errWriter)
112+
outWriter.Reset()
113+
rootCmd.SetOut(&outWriter)
114+
err = rootCmd.ExecuteContext(s.ctx)
115+
require.NoError(err)
116+
117+
s.T().Log(outWriter.String())
118+
s.T().Log(errWriter.String())
119+
120+
newLastModified, err := datastore.GetFileLastModified(s.ctx, "FFFFFFFF--0-9/FFFFFFFA--5.xdr.zstd")
121+
require.NoError(err)
122+
require.Equal(lastModified, newLastModified)
123+
124+
_, err = datastore.GetFile(s.ctx, "FFFFFFFF--0-9/FFFFFFF6--9.xdr.zstd")
125+
require.NoError(err)
103126
}
104127

105128
func (s *GalexieTestSuite) TestAppend() {
@@ -117,7 +140,7 @@ func (s *GalexieTestSuite) TestAppend() {
117140
lastModified, err := datastore.GetFileLastModified(s.ctx, "FFFFFFFF--0-9/FFFFFFF9--6.xdr.zstd")
118141
require.NoError(err)
119142

120-
// now run an append of overalapping range, it will resume past existing ledgers
143+
// now run an append on an overlapping range, it will resume past existing ledgers
121144
rootCmd.SetArgs([]string{"append", "--start", "6", "--end", "9", "--config-file", s.tempConfigFile})
122145
var errWriter bytes.Buffer
123146
var outWriter bytes.Buffer

0 commit comments

Comments
 (0)