Skip to content

Commit

Permalink
Exclude Instead of Ignore With Gazelle (#8559)
Browse files Browse the repository at this point in the history
* exclude and not ignore

* fix broken test

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
  • Loading branch information
rauljordan and prylabs-bulldozer[bot] committed Mar 4, 2021
1 parent c1d4ff6 commit 32f2f71
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
21 changes: 17 additions & 4 deletions beacon-chain/db/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@prysm//tools/go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_test")

# Build with --define=kafka_enabled=false to exclude kafka wrapper.
config_setting(
name = "kafka_disabled",
values = {"define": "kafka_enabled=false"},
)

# gazelle:ignore db.go db_kafka_wrapped.go
# gazelle:exclude db.go db_kafka_wrapped.go
go_library(
name = "go_default_library",
srcs = [
Expand Down Expand Up @@ -49,7 +50,19 @@ go_library(

go_test(
name = "go_default_test",
srcs = ["db_test.go"],
srcs = [
"db_test.go",
"restore_test.go",
],
embed = [":go_default_library"],
deps = ["//beacon-chain/db/kv:go_default_library"],
deps = [
"//beacon-chain/db/kv:go_default_library",
"//shared/cmd:go_default_library",
"//shared/testutil:go_default_library",
"//shared/testutil/assert:go_default_library",
"//shared/testutil/require:go_default_library",
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
"@com_github_urfave_cli_v2//:go_default_library",
],
)
5 changes: 1 addition & 4 deletions beacon-chain/db/restore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ func TestRestore(t *testing.T) {
ctx := context.Background()

backupDb, err := kv.NewKVStore(context.Background(), t.TempDir(), &kv.Config{})
defer func() {
require.NoError(t, backupDb.Close())
}()
require.NoError(t, err)
head := testutil.NewBeaconBlock()
head.Block.Slot = 5000
Expand Down Expand Up @@ -53,7 +50,7 @@ func TestRestore(t *testing.T) {
require.NoError(t, set.Set(cmd.RestoreTargetDirFlag.Name, restoreDir))
cliCtx := cli.NewContext(&app, set, nil)

assert.NoError(t, restore(cliCtx))
assert.NoError(t, Restore(cliCtx))

files, err := ioutil.ReadDir(path.Join(restoreDir, kv.BeaconNodeDbDirName))
require.NoError(t, err)
Expand Down

0 comments on commit 32f2f71

Please sign in to comment.