Skip to content

Commit

Permalink
fix: config tests
Browse files Browse the repository at this point in the history
  • Loading branch information
samlaf committed Sep 20, 2024
1 parent 6befa7c commit e40d785
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions server/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ func validCfg() *Config {
PutBlobEncodingVersion: 0,
DisablePointVerificationMode: false,
},
G1Path: "path/to/g1",
G2PowerOfTauPath: "path/to/g2",
CacheDir: "path/to/cache",
MaxBlobLength: "2MiB",
SvcManagerAddr: "0x1234567890abcdef",
EthRPC: "http://localhost:8545",
EthConfirmationDepth: 12,
MemstoreEnabled: true,
MemstoreBlobExpiration: 25 * time.Minute,
G1Path: "path/to/g1",
G2PowerOfTauPath: "path/to/g2",
CacheDir: "path/to/cache",
MaxBlobLength: "2MiB",
CertVerificationEnabled: false,
SvcManagerAddr: "0x1234567890abcdef",
EthRPC: "http://localhost:8545",
EthConfirmationDepth: 12,
MemstoreEnabled: true,
MemstoreBlobExpiration: 25 * time.Minute,
}
}

Expand Down Expand Up @@ -71,12 +72,14 @@ func TestConfigVerification(t *testing.T) {
require.Error(t, err)
})

t.Run("EigenDABackend", func(t *testing.T) {
t.Run("CertVerificationEnabled", func(t *testing.T) {
// when eigenDABackend is enabled (memstore.enabled = false),
// some extra fields are required.
t.Run("MissingSvcManagerAddr", func(t *testing.T) {
cfg := validCfg()
// cert verification only makes sense when memstore is disabled (we use eigenda as backend)
cfg.MemstoreEnabled = false
cfg.CertVerificationEnabled = true
cfg.SvcManagerAddr = ""

err := cfg.Check()
Expand All @@ -85,12 +88,23 @@ func TestConfigVerification(t *testing.T) {

t.Run("MissingEthRPC", func(t *testing.T) {
cfg := validCfg()
// cert verification only makes sense when memstore is disabled (we use eigenda as backend)
cfg.MemstoreEnabled = false
cfg.CertVerificationEnabled = true
cfg.EthRPC = ""

err := cfg.Check()
require.Error(t, err)
})

t.Run("CantDoCertVerificationWhenMemstoreEnabled", func(t *testing.T) {
cfg := validCfg()
cfg.MemstoreEnabled = true
cfg.CertVerificationEnabled = true

err := cfg.Check()
require.Error(t, err)
})
})

t.Run("MissingS3AccessKeys", func(t *testing.T) {
Expand Down

0 comments on commit e40d785

Please sign in to comment.