Skip to content

Commit

Permalink
Linting improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Olshansk committed Jul 29, 2023
1 parent e74cc90 commit 9d840ed
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
6 changes: 3 additions & 3 deletions app/client/cli/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ func newDebugSubCommands() []*cobra.Command {
if !slices.Contains(validActors, actor) {
logger.Global.Fatal().Msg("Invalid actor type provided")
}
sedCmd := exec.Command("sed", "-i", fmt.Sprintf("/%s:/,/count:/ s/count: [0-9]*/count: %s/", actor, numActors), "/usr/local/localnet_config.yaml")
err := sedCmd.Run()
if err != nil {
sedReplaceCmd := fmt.Sprintf("/%s:/,/count:/ s/count: [0-9]*/count: %s/", actor, numActors)
sedCmd := exec.Command("sed", "-i", sedReplaceCmd, "/usr/local/localnet_config.yaml")
if err := sedCmd.Run(); err != nil {
log.Fatal(err)
}
},
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/node.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// //go:build e2e
//go:build e2e

package e2e

Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/state_sync.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ Feature: State Sync Namespace
# full_nodes is the key used in `localnet_config.yaml`
When the developer runs the command "ScaleActor full_nodes 2"
# IMPROVE: Figure out if there's something better to do then waiting for a node to spin up
And the developer waits for "20000" milliseconds
And the developer waits for "40000" milliseconds
# TODO(#812): The full node should be at height "2" after state sync is implemented
Then "full-node-002" should be at height "1"
Then "full-node-002" should be at height "0"
10 changes: 5 additions & 5 deletions e2e/tests/steps_init_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// // go:build e2e
//go:build e2e

package e2e

Expand Down Expand Up @@ -161,8 +161,8 @@ func (s *rootSuite) TheNetworkHasActorsOfType(num int64, actor string) {
}

func (s *rootSuite) ShouldBeUnreachable(pod string) {
validate := func(res *string) bool {
return res != nil && strings.Contains(*res, "Unable to connect to the RPC")
validate := func(res string) bool {
return strings.Contains(res, "Unable to connect to the RPC")
}
args := []string{
"Query",
Expand Down Expand Up @@ -329,10 +329,10 @@ func getResponseFromStdout[T any](t gocuke.TestingT, stdout string, validate fun
return nil
}

func getStrFromStdout(t gocuke.TestingT, stdout string, validate func(res *string) bool) *string {
func getStrFromStdout(t gocuke.TestingT, stdout string, validate func(res string) bool) *string {
t.Helper()
for _, s := range strings.Split(stdout, "\n") {
if !validate(&s) {
if !validate(s) {
continue
}
return &s
Expand Down
10 changes: 4 additions & 6 deletions e2e/tests/tilt_helpers.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// // go:build e2e
//go:build e2e

package e2e

import (
Expand All @@ -14,17 +15,14 @@ func (s *rootSuite) syncLocalNetConfigFromHostToLocalFS() {
return
}
sedCmd := exec.Command("tilt", "trigger", "syncback_localnet_config")
err := sedCmd.Run()
if err != nil {
if err := sedCmd.Run(); err != nil {
e2eLogger.Err(err).Msgf("syncLocalNetConfigFromHostToLocalFS: failed to run command: '%s'", sedCmd.String())
log.Fatal(err)
}
}

func isPackageInstalled(pkg string) bool {
_, err := exec.LookPath(pkg)
// check error
if err != nil {
if _, err := exec.LookPath(pkg); err != nil {
// the executable is not found, return false
if execErr, ok := err.(*exec.Error); ok && execErr.Err == exec.ErrNotFound {
return false
Expand Down

0 comments on commit 9d840ed

Please sign in to comment.