forked from 0xPolygon/cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
112 changed files
with
7,119 additions
and
2,453 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ jobs: | |
run: | | ||
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list | ||
sudo apt update | ||
sudo apt install kurtosis-cli=1.3.0 | ||
sudo apt install kurtosis-cli=1.4.1 | ||
kurtosis version | ||
- name: Disable kurtosis analytics | ||
|
@@ -70,7 +70,7 @@ jobs: | |
with: | ||
repository: 0xPolygon/kurtosis-cdk | ||
path: "kurtosis-cdk" | ||
ref: "v0.2.15" | ||
ref: "v0.2.19" | ||
|
||
- name: Setup Bats and bats libs | ||
uses: bats-core/[email protected] | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,76 @@ | ||
package agglayer | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/0xPolygon/cdk-rpc/rpc" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
const ( | ||
testURL = "http://localhost:8080" | ||
) | ||
|
||
func TestExploratoryClient(t *testing.T) { | ||
t.Skip("This test is for exploratory purposes only") | ||
sut := NewAggLayerClient("http://127.0.0.1:32853") | ||
config, err := sut.GetEpochConfiguration() | ||
require.NoError(t, err) | ||
require.NotNil(t, config) | ||
fmt.Printf("Config: %s", config.String()) | ||
} | ||
|
||
func TestGetEpochConfigurationResponseWithError(t *testing.T) { | ||
sut := NewAggLayerClient(testURL) | ||
response := rpc.Response{ | ||
Error: &rpc.ErrorObject{}, | ||
} | ||
jSONRPCCall = func(url, method string, params ...interface{}) (rpc.Response, error) { | ||
return response, nil | ||
} | ||
clockConfig, err := sut.GetEpochConfiguration() | ||
require.Nil(t, clockConfig) | ||
require.Error(t, err) | ||
} | ||
|
||
func TestGetEpochConfigurationResponseBadJson(t *testing.T) { | ||
sut := NewAggLayerClient(testURL) | ||
response := rpc.Response{ | ||
Result: []byte(`{`), | ||
} | ||
jSONRPCCall = func(url, method string, params ...interface{}) (rpc.Response, error) { | ||
return response, nil | ||
} | ||
clockConfig, err := sut.GetEpochConfiguration() | ||
require.Nil(t, clockConfig) | ||
require.Error(t, err) | ||
} | ||
|
||
func TestGetEpochConfigurationErrorResponse(t *testing.T) { | ||
sut := NewAggLayerClient(testURL) | ||
|
||
jSONRPCCall = func(url, method string, params ...interface{}) (rpc.Response, error) { | ||
return rpc.Response{}, fmt.Errorf("unittest error") | ||
} | ||
clockConfig, err := sut.GetEpochConfiguration() | ||
require.Nil(t, clockConfig) | ||
require.Error(t, err) | ||
} | ||
|
||
func TestGetEpochConfigurationOkResponse(t *testing.T) { | ||
sut := NewAggLayerClient(testURL) | ||
response := rpc.Response{ | ||
Result: []byte(`{"epoch_duration": 1, "genesis_block": 1}`), | ||
} | ||
jSONRPCCall = func(url, method string, params ...interface{}) (rpc.Response, error) { | ||
return response, nil | ||
} | ||
clockConfig, err := sut.GetEpochConfiguration() | ||
require.NotNil(t, clockConfig) | ||
require.NoError(t, err) | ||
require.Equal(t, ClockConfiguration{ | ||
EpochDuration: 1, | ||
GenesisBlock: 1, | ||
}, *clockConfig) | ||
} |
Oops, something went wrong.