mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-26 05:17:22 +00:00
d077483577
* v3 import renamings * tidy * fmt * rev * Update beacon-chain/core/epoch/precompute/reward_penalty_test.go * Update beacon-chain/core/helpers/validators_test.go * Update beacon-chain/db/alias.go * Update beacon-chain/db/alias.go * Update beacon-chain/db/alias.go * Update beacon-chain/db/iface/BUILD.bazel * Update beacon-chain/db/kv/kv.go * Update beacon-chain/db/kv/state.go * Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go * Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go * Update beacon-chain/sync/initial-sync/service.go * fix deps * fix bad replacements * fix bad replacements * change back * gohashtree version * fix deps Co-authored-by: Nishant Das <nishdas93@gmail.com> Co-authored-by: Potuz <potuz@prysmaticlabs.com>
57 lines
2.3 KiB
Go
57 lines
2.3 KiB
Go
package gateway
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/v3/api/gateway"
|
|
"github.com/prysmaticlabs/prysm/v3/testing/assert"
|
|
"github.com/prysmaticlabs/prysm/v3/testing/require"
|
|
)
|
|
|
|
func TestDefaultConfig(t *testing.T) {
|
|
t.Run("Without debug endpoints", func(t *testing.T) {
|
|
cfg := DefaultConfig(false, "eth,prysm")
|
|
assert.NotNil(t, cfg.EthPbMux.Mux)
|
|
require.Equal(t, 2, len(cfg.EthPbMux.Patterns))
|
|
assert.Equal(t, "/internal/eth/v1/", cfg.EthPbMux.Patterns[0])
|
|
assert.Equal(t, "/internal/eth/v2/", cfg.EthPbMux.Patterns[1])
|
|
assert.Equal(t, 4, len(cfg.EthPbMux.Registrations))
|
|
assert.NotNil(t, cfg.V1AlphaPbMux.Mux)
|
|
require.Equal(t, 2, len(cfg.V1AlphaPbMux.Patterns))
|
|
assert.Equal(t, "/eth/v1alpha1/", cfg.V1AlphaPbMux.Patterns[0])
|
|
assert.Equal(t, "/eth/v1alpha2/", cfg.V1AlphaPbMux.Patterns[1])
|
|
assert.Equal(t, 4, len(cfg.V1AlphaPbMux.Registrations))
|
|
})
|
|
|
|
t.Run("With debug endpoints", func(t *testing.T) {
|
|
cfg := DefaultConfig(true, "eth,prysm")
|
|
assert.NotNil(t, cfg.EthPbMux.Mux)
|
|
require.Equal(t, 2, len(cfg.EthPbMux.Patterns))
|
|
assert.Equal(t, "/internal/eth/v1/", cfg.EthPbMux.Patterns[0])
|
|
assert.Equal(t, "/internal/eth/v2/", cfg.EthPbMux.Patterns[1])
|
|
assert.Equal(t, 5, len(cfg.EthPbMux.Registrations))
|
|
assert.NotNil(t, cfg.V1AlphaPbMux.Mux)
|
|
require.Equal(t, 2, len(cfg.V1AlphaPbMux.Patterns))
|
|
assert.Equal(t, "/eth/v1alpha1/", cfg.V1AlphaPbMux.Patterns[0])
|
|
assert.Equal(t, "/eth/v1alpha2/", cfg.V1AlphaPbMux.Patterns[1])
|
|
assert.Equal(t, 5, len(cfg.V1AlphaPbMux.Registrations))
|
|
})
|
|
t.Run("Without Prysm API", func(t *testing.T) {
|
|
cfg := DefaultConfig(true, "eth")
|
|
assert.NotNil(t, cfg.EthPbMux.Mux)
|
|
require.Equal(t, 2, len(cfg.EthPbMux.Patterns))
|
|
assert.Equal(t, "/internal/eth/v1/", cfg.EthPbMux.Patterns[0])
|
|
assert.Equal(t, 5, len(cfg.EthPbMux.Registrations))
|
|
assert.Equal(t, (*gateway.PbMux)(nil), cfg.V1AlphaPbMux)
|
|
})
|
|
t.Run("Without Eth API", func(t *testing.T) {
|
|
cfg := DefaultConfig(true, "prysm")
|
|
assert.Equal(t, (*gateway.PbMux)(nil), cfg.EthPbMux)
|
|
assert.NotNil(t, cfg.V1AlphaPbMux.Mux)
|
|
require.Equal(t, 2, len(cfg.V1AlphaPbMux.Patterns))
|
|
assert.Equal(t, "/eth/v1alpha1/", cfg.V1AlphaPbMux.Patterns[0])
|
|
assert.Equal(t, "/eth/v1alpha2/", cfg.V1AlphaPbMux.Patterns[1])
|
|
assert.Equal(t, 5, len(cfg.V1AlphaPbMux.Registrations))
|
|
})
|
|
}
|