Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importer: rewrite make integration #1485

Merged
merged 8 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ commands:
- run:
command: make test
no_output_timeout: 15m
- run: make integration
- run: make test-generate
- run: make fakepackage

Expand Down
5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ lint: go-algorand
fmt:
go fmt ./...

integration: cmd/algorand-indexer/algorand-indexer
mkdir -p test/blockdata
curl -s https://algorand-testdata.s3.amazonaws.com/indexer/test_blockdata/create_destroy.tar.bz2 -o test/blockdata/create_destroy.tar.bz2
test/postgres_integration_test.sh

# note: when running e2e tests manually be sure to set the e2e filename:
# 'export CI_E2E_FILENAME=rel-nightly'
# To keep the container running at exit set 'export EXTRA="--keep-alive"',
Expand Down
444 changes: 444 additions & 0 deletions api/handlers_e2e_test.go

Large diffs are not rendered by default.

Binary file added api/test_resources/validated_blocks/Accounts1.vb
Binary file not shown.
Binary file added api/test_resources/validated_blocks/Accounts2.vb
Binary file not shown.
Binary file added api/test_resources/validated_blocks/Accounts3.vb
Binary file not shown.
Binary file added api/test_resources/validated_blocks/Accounts4.vb
Binary file not shown.
Binary file added api/test_resources/validated_blocks/Accounts5.vb
Binary file not shown.
Binary file added api/test_resources/validated_blocks/AppDelete.vb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
51 changes: 0 additions & 51 deletions cmd/algorand-indexer/import.go

This file was deleted.

3 changes: 0 additions & 3 deletions cmd/algorand-indexer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ func init() {
logger.SetOutput(os.Stdout)
logger.SetLevel(log.InfoLevel)

rootCmd.AddCommand(importCmd)
importCmd.Hidden = true
daemonCmd := DaemonCmd()
rootCmd.AddCommand(daemonCmd)
rootCmd.AddCommand(apiConfigCmd)
Expand All @@ -129,7 +127,6 @@ func init() {
cmd.Flags().BoolVarP(&doVersion, "version", "v", false, "print version and exit")
}
addFlags(daemonCmd)
addFlags(importCmd)

viper.RegisterAlias("postgres", "postgres-connection-string")

Expand Down
4 changes: 2 additions & 2 deletions conduit/plugins/exporters/postgresql/postgresql_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"github.com/algorand/indexer/idb"
// Necessary to ensure the postgres implementation has been registered in the idb factory
_ "github.com/algorand/indexer/idb/postgres"
"github.com/algorand/indexer/importer"
"github.com/algorand/indexer/types"
iutil "github.com/algorand/indexer/util"

sdk "github.com/algorand/go-algorand-sdk/v2/types"
)
Expand Down Expand Up @@ -78,7 +78,7 @@ func (exp *postgresqlExporter) Init(ctx context.Context, initProvider data.InitP
}
exp.db = db
<-ready
_, err = importer.EnsureInitialImport(exp.db, *initProvider.GetGenesis())
_, err = iutil.EnsureInitialImport(exp.db, *initProvider.GetGenesis())
if err != nil {
return fmt.Errorf("error importing genesis: %v", err)
}
Expand Down
5 changes: 2 additions & 3 deletions idb/postgres/postgres_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/algorand/indexer/idb/postgres/internal/schema"
pgtest "github.com/algorand/indexer/idb/postgres/internal/testing"
pgutil "github.com/algorand/indexer/idb/postgres/internal/util"
"github.com/algorand/indexer/importer"
"github.com/algorand/indexer/protocol"
"github.com/algorand/indexer/util"
"github.com/algorand/indexer/util/test"
Expand Down Expand Up @@ -1977,7 +1976,7 @@ func TestGenesisHashCheckAtInitialImport(t *testing.T) {
genesisReader := bytes.NewReader(json.Encode(genesis))
gen, err := util.ReadGenesis(genesisReader)
require.NoError(t, err)
imported, err := importer.EnsureInitialImport(db, gen)
imported, err := util.EnsureInitialImport(db, gen)
require.NoError(t, err)
require.True(t, true, imported)
// network state should be set
Expand All @@ -1991,7 +1990,7 @@ func TestGenesisHashCheckAtInitialImport(t *testing.T) {
gen, err = util.ReadGenesis(genesisReader)
require.NoError(t, err)
// different genesisHash, should fail
_, err = importer.EnsureInitialImport(db, gen)
_, err = util.EnsureInitialImport(db, gen)
require.Error(t, err)
require.Contains(t, err.Error(), "genesis hash not matching")

Expand Down
Loading