-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(relconfig): decimals config validation (#2919)
* decimals implementation * add test * add test * lint * [goreleaser] * handle native gas token * combine into Validate func * commnent * [goreleaser] * better call to loadconfig and abstract away validate * abstract away validate * [goreleaser] --------- Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>
- Loading branch information
1 parent
6b4f1ed
commit 48de090
Showing
4 changed files
with
189 additions
and
10 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
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,50 @@ | ||
package relconfig_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/suite" | ||
"github.com/synapsecns/sanguine/core" | ||
"github.com/synapsecns/sanguine/core/metrics" | ||
"github.com/synapsecns/sanguine/core/metrics/localmetrics" | ||
"github.com/synapsecns/sanguine/core/testsuite" | ||
omniClient "github.com/synapsecns/sanguine/services/omnirpc/client" | ||
"github.com/synapsecns/sanguine/services/rfq/relayer/metadata" | ||
) | ||
|
||
func TestValidateDecimalsSuite(t *testing.T) { | ||
suite.Run(t, NewTestSuite(t)) | ||
} | ||
|
||
type ValidateDecimalsSuite struct { | ||
*testsuite.TestSuite | ||
// testBackends contains a list of all test backends | ||
metricsHandler metrics.Handler | ||
omniClient omniClient.RPCClient | ||
} | ||
|
||
// NewTestSuite creates a new test suite. | ||
func NewTestSuite(tb testing.TB) *ValidateDecimalsSuite { | ||
tb.Helper() | ||
return &ValidateDecimalsSuite{ | ||
TestSuite: testsuite.NewTestSuite(tb), | ||
} | ||
} | ||
|
||
func (v *ValidateDecimalsSuite) SetupSuite() { | ||
v.TestSuite.SetupSuite() | ||
|
||
var err error | ||
// don't use metrics on ci for integration tests | ||
isCI := core.GetEnvBool("CI", false) | ||
metricsHandler := metrics.Null | ||
|
||
if !isCI { | ||
localmetrics.SetupTestJaeger(v.GetSuiteContext(), v.T()) | ||
metricsHandler = metrics.Jaeger | ||
} | ||
v.metricsHandler, err = metrics.NewByType(v.GetSuiteContext(), metadata.BuildInfo(), metricsHandler) | ||
v.Require().NoError(err) | ||
|
||
v.omniClient = omniClient.NewOmnirpcClient("https://rpc.omnirpc.io", v.metricsHandler, omniClient.WithCaptureReqRes()) | ||
} |