Skip to content

Commit

Permalink
Rename TestEnvinronment to TestEnvironment (ava-labs#2618)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhrubabasu authored Feb 16, 2023
1 parent 9df8dc9 commit 31336c0
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions tests/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const (

// Env is the global struct containing all we need to test
var (
Env = &TestEnvinronment{
Env = &TestEnvironment{
testEnvironmentConfig: &testEnvironmentConfig{
clusterType: Unknown,
},
Expand All @@ -67,7 +67,7 @@ type testEnvironmentConfig struct {
snapshotName string
}

type TestEnvinronment struct {
type TestEnvironment struct {
*testEnvironmentConfig

runnerMu sync.RWMutex
Expand All @@ -87,7 +87,7 @@ type TestEnvinronment struct {
// should be called only once
// must be called before StartCluster
// Note that either networkRunnerGRPCEp or uris must be specified
func (te *TestEnvinronment) ConfigCluster(
func (te *TestEnvironment) ConfigCluster(
logLevel string,
networkRunnerGRPCEp string,
avalancheGoExecPath string,
Expand Down Expand Up @@ -139,7 +139,7 @@ func (te *TestEnvinronment) ConfigCluster(
}
}

func (te *TestEnvinronment) LoadKeys() error {
func (te *TestEnvironment) LoadKeys() error {
// load test keys
if len(te.testKeysFile) == 0 {
return errNoKeyFile
Expand All @@ -152,7 +152,7 @@ func (te *TestEnvinronment) LoadKeys() error {
return nil
}

func (te *TestEnvinronment) StartCluster() error {
func (te *TestEnvironment) StartCluster() error {
switch te.clusterType {
case StandAlone:
tests.Outf("{{magenta}}starting network-runner with %q{{/}}\n", te.avalancheGoExecPath)
Expand Down Expand Up @@ -187,7 +187,7 @@ func (te *TestEnvinronment) StartCluster() error {
}
}

func (te *TestEnvinronment) refreshURIs() error {
func (te *TestEnvironment) refreshURIs() error {
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
uriSlice, err := te.GetRunnerClient().URIs(ctx)
cancel()
Expand All @@ -199,7 +199,7 @@ func (te *TestEnvinronment) refreshURIs() error {
return nil
}

func (te *TestEnvinronment) setRunnerClient(logLevel string, gRPCEp string) error {
func (te *TestEnvironment) setRunnerClient(logLevel string, gRPCEp string) error {
te.runnerMu.Lock()
defer te.runnerMu.Unlock()

Expand All @@ -219,47 +219,47 @@ func (te *TestEnvinronment) setRunnerClient(logLevel string, gRPCEp string) erro
return err
}

func (te *TestEnvinronment) GetRunnerClient() (cli runner_sdk.Client) {
func (te *TestEnvironment) GetRunnerClient() (cli runner_sdk.Client) {
te.runnerMu.RLock()
cli = te.runnerCli
te.runnerMu.RUnlock()
return cli
}

func (te *TestEnvinronment) closeRunnerClient() (err error) {
func (te *TestEnvironment) closeRunnerClient() (err error) {
te.runnerMu.Lock()
err = te.runnerCli.Close()
te.runnerMu.Unlock()
return err
}

func (te *TestEnvinronment) GetRunnerGRPCEndpoint() (ep string) {
func (te *TestEnvironment) GetRunnerGRPCEndpoint() (ep string) {
te.runnerMu.RLock()
ep = te.runnerGRPCEp
te.runnerMu.RUnlock()
return ep
}

func (te *TestEnvinronment) setURIs(us []string) {
func (te *TestEnvironment) setURIs(us []string) {
te.urisMu.Lock()
te.uris = us
te.urisMu.Unlock()
}

func (te *TestEnvinronment) GetURIs() []string {
func (te *TestEnvironment) GetURIs() []string {
te.urisMu.RLock()
us := te.uris
te.urisMu.RUnlock()
return us
}

func (te *TestEnvinronment) setTestKeys(ks []*secp256k1.PrivateKey) {
func (te *TestEnvironment) setTestKeys(ks []*secp256k1.PrivateKey) {
te.testKeysMu.Lock()
te.testKeys = ks
te.testKeysMu.Unlock()
}

func (te *TestEnvinronment) GetTestKeys() ([]*secp256k1.PrivateKey, []ids.ShortID, *secp256k1fx.Keychain) {
func (te *TestEnvironment) GetTestKeys() ([]*secp256k1.PrivateKey, []ids.ShortID, *secp256k1fx.Keychain) {
te.testKeysMu.RLock()
testKeys := te.testKeys
te.testKeysMu.RUnlock()
Expand All @@ -271,7 +271,7 @@ func (te *TestEnvinronment) GetTestKeys() ([]*secp256k1.PrivateKey, []ids.ShortI
return testKeys, testKeyAddrs, keyChain
}

func (te *TestEnvinronment) ShutdownCluster() error {
func (te *TestEnvironment) ShutdownCluster() error {
if te.GetRunnerGRPCEndpoint() == "" {
// we connected directly to existing cluster
// nothing to shutdown
Expand All @@ -295,7 +295,7 @@ func (te *TestEnvinronment) ShutdownCluster() error {
return te.closeRunnerClient()
}

func (te *TestEnvinronment) SnapInitialState() error {
func (te *TestEnvironment) SnapInitialState() error {
te.snapMu.RLock()
defer te.snapMu.RUnlock()

Expand All @@ -313,7 +313,7 @@ func (te *TestEnvinronment) SnapInitialState() error {
return nil
}

func (te *TestEnvinronment) RestoreInitialState(switchOffNetworkFirst bool) error {
func (te *TestEnvironment) RestoreInitialState(switchOffNetworkFirst bool) error {
te.snapMu.Lock()
defer te.snapMu.Unlock()

Expand Down

0 comments on commit 31336c0

Please sign in to comment.