-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(config): disable claimer on experimental mode
- Loading branch information
1 parent
541847c
commit d5adfed
Showing
6 changed files
with
57 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,5 @@ services: | |
CARTESI_FEATURE_DISABLE_CLAIMER: "false" | ||
CARTESI_HTTP_ADDRESS: "0.0.0.0" | ||
CARTESI_HTTP_PORT: "10000" | ||
CARTESI_EXPERIMENTAL_SUNODO_VALIDATOR_ENABLED: true | ||
CARTESI_EXPERIMENTAL_SUNODO_VALIDATOR_REDIS_ENDPOINT: redis://default:[email protected]:6379 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// (c) Cartesi and individual authors (see AUTHORS) | ||
// SPDX-License-Identifier: Apache-2.0 (see LICENSE) | ||
|
||
package config | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
type ConfigTestSuite struct { | ||
suite.Suite | ||
} | ||
|
||
func (s *ConfigTestSuite) SetupSuite() { | ||
os.Setenv("CARTESI_BLOCKCHAIN_ID", "31337") | ||
os.Setenv("CARTESI_BLOCKCHAIN_HTTP_ENDPOINT", "http://localhost:8545") | ||
os.Setenv("CARTESI_BLOCKCHAIN_WS_ENDPOINT", "ws://localhost:8545") | ||
os.Setenv("CARTESI_CONTRACTS_APPLICATION_ADDRESS", "0x") | ||
os.Setenv("CARTESI_CONTRACTS_HISTORY_ADDRESS", "0x") | ||
os.Setenv("CARTESI_CONTRACTS_AUTHORITY_ADDRESS", "0x") | ||
os.Setenv("CARTESI_CONTRACTS_INPUT_BOX_ADDRESS", "0x") | ||
os.Setenv("CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER", "0") | ||
os.Setenv("CARTESI_SNAPSHOT_DIR", "/tmp") | ||
} | ||
|
||
func TestConfigTest(t *testing.T) { | ||
suite.Run(t, new(ConfigTestSuite)) | ||
} | ||
|
||
func (s *ConfigTestSuite) TestExperimentalSunodoValidatorModeDisablesClaimer() { | ||
os.Setenv("CARTESI_EXPERIMENTAL_SUNODO_VALIDATOR_ENABLED", "true") | ||
os.Setenv("CARTESI_EXPERIMENTAL_SUNODO_VALIDATOR_REDIS_ENDPOINT", "redis://") | ||
c := FromEnv() | ||
assert.Equal(s.T(), true, c.FeatureDisableClaimer) | ||
} | ||
|
||
func (s *ConfigTestSuite) TestAuthIsNotSetWhenClaimerIsDisabled() { | ||
os.Setenv("CARTESI_FEATURE_DISABLE_CLAIMER", "true") | ||
c := FromEnv() | ||
assert.Nil(s.T(), c.Auth) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters