Skip to content

Commit

Permalink
Corrected tests to use consesnsus_Core for forks
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkLord017 committed Sep 22, 2024
1 parent 94eec89 commit 9b7137d
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package config
import (
"encoding/hex"
"fmt"
"github.com/spf13/viper"
"os"
"reflect"
"testing"

"github.com/BlocSoc-iitr/selene/consensus/consensus_core"
"github.com/spf13/viper"
)

var (
Expand All @@ -23,9 +25,9 @@ var (
defaultCheckpoint = [32]byte{}
)

/////////////////////////////
///// from_file() tests /////
/////////////////////////////
// ///////////////////////////
// /// from_file() tests /////
// ///////////////////////////
func TestMainnetBaseConfig(t *testing.T) {
network := "MAINNET"
path := "./config.toml"
Expand All @@ -44,8 +46,8 @@ func TestMainnetBaseConfig(t *testing.T) {
if !reflect.DeepEqual(config.Chain, mainnetConfig.Chain) {
t.Errorf("Expected Chain to be %v, but got %v", mainnetConfig.Chain, config.Chain)
}
if !reflect.DeepEqual(config.Forks, mainnetConfig.Forks) {
t.Errorf("Expected Forks to be %v, but got %v", mainnetConfig.Forks, config.Forks)
if !reflect.DeepEqual(consensus_core.Forks, mainnetConfig.Forks) {

Check failure on line 49 in config/config_test.go

View workflow job for this annotation

GitHub Actions / build (1.22.3)

consensus_core.Forks (type) is not an expression

Check failure on line 49 in config/config_test.go

View workflow job for this annotation

GitHub Actions / test

consensus_core.Forks (type) is not an expression

Check failure on line 49 in config/config_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint (/home/runner/work/selene/selene)

consensus_core.Forks (type) is not an expression
t.Errorf("Expected Forks to be %v, but got %v", mainnetConfig.Forks, consensus_core.Forks)

Check failure on line 50 in config/config_test.go

View workflow job for this annotation

GitHub Actions / build (1.22.3)

consensus_core.Forks (type) is not an expression

Check failure on line 50 in config/config_test.go

View workflow job for this annotation

GitHub Actions / test

consensus_core.Forks (type) is not an expression

Check failure on line 50 in config/config_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint (/home/runner/work/selene/selene)

consensus_core.Forks (type) is not an expression
}
if *config.RpcBindIp != mainnetConfig.RpcBindIp {
t.Errorf("Expected RpcBindIP to be %s, but got %s", mainnetConfig.RpcBindIp, *config.RpcBindIp)
Expand Down Expand Up @@ -179,9 +181,9 @@ func createConfigFile(v *viper.Viper) {
}
}

//////////////////////////////////
///// to_base_config() tests /////
//////////////////////////////////
// ////////////////////////////////
// /// to_base_config() tests /////
// ////////////////////////////////
func TestReturnsCorrectBaseConfig(t *testing.T) {
config := Config{
ConsensusRpc: consensusRpc,
Expand All @@ -201,8 +203,8 @@ func TestReturnsCorrectBaseConfig(t *testing.T) {
if !reflect.DeepEqual(baseConfig.Chain, config.Chain) {
t.Errorf("Expected Chain to be %v, got %v", config.Chain, baseConfig.Chain)
}
if !reflect.DeepEqual(baseConfig.Forks, config.Forks) {
t.Errorf("Expected Forks to be %v, got %v", config.Forks, baseConfig.Forks)
if !reflect.DeepEqual(baseConfig.Forks, consensus_core.Forks) {

Check failure on line 206 in config/config_test.go

View workflow job for this annotation

GitHub Actions / build (1.22.3)

consensus_core.Forks (type) is not an expression

Check failure on line 206 in config/config_test.go

View workflow job for this annotation

GitHub Actions / test

consensus_core.Forks (type) is not an expression

Check failure on line 206 in config/config_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint (/home/runner/work/selene/selene)

consensus_core.Forks (type) is not an expression
t.Errorf("Expected Forks to be %v, got %v", consensus_core.Forks, baseConfig.Forks)

Check failure on line 207 in config/config_test.go

View workflow job for this annotation

GitHub Actions / build (1.22.3)

consensus_core.Forks (type) is not an expression

Check failure on line 207 in config/config_test.go

View workflow job for this annotation

GitHub Actions / test

consensus_core.Forks (type) is not an expression

Check failure on line 207 in config/config_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint (/home/runner/work/selene/selene)

consensus_core.Forks (type) is not an expression
}
if baseConfig.MaxCheckpointAge != config.MaxCheckpointAge {
t.Errorf("Expected Max Checkpoint age to be %v, got %v", config.MaxCheckpointAge, baseConfig.MaxCheckpointAge)
Expand Down Expand Up @@ -230,4 +232,4 @@ func TestReturnsCorrectDefaultValues(t *testing.T) {
if baseConfig.RpcBindIp != "127.0.0.1" {
t.Errorf("Expected Max Checkpoint age to be %v, got %v", "127.0.0.1", baseConfig.RpcBindIp)
}
}
}

0 comments on commit 9b7137d

Please sign in to comment.