Skip to content

Commit

Permalink
fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
jbowen93 committed Feb 21, 2022
1 parent 636ab17 commit f185ff3
Showing 1 changed file with 49 additions and 38 deletions.
87 changes: 49 additions & 38 deletions cmd/celestia/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"os"
"testing"

cmdnode "github.com/celestiaorg/celestia-node/cmd"
"github.com/stretchr/testify/require"

cmdnode "github.com/celestiaorg/celestia-node/cmd"
)

func TestLight(t *testing.T) {
Expand All @@ -17,39 +18,44 @@ func TestLight(t *testing.T) {
require.NoError(t, err, "error creating a temporary test directory")
testDir, err := os.Getwd()
require.NoError(t, err, "error getting the current working directory")
defer os.Chdir(testDir)
err = os.Chdir(tmpDir)
require.NoError(t, err, "error changing to the temporary test directory")

t.Run("init", func(t *testing.T) {
output := &bytes.Buffer{}
rootCmd.SetOut(output)
rootCmd.SetArgs([]string{
"bridge",
"bridge",
"--node.store", ".celestia-light",
"init",
})
err := rootCmd.ExecuteContext(cmdnode.WithEnv(context.Background()))
require.NoError(t, err)
})

// Commented out until a dry-run option can be implemented
/*
t.Run("start", func(t *testing.T) {
output := &bytes.Buffer{}
rootCmd.SetOut(output)
rootCmd.SetArgs([]string{
"light",
"--node.store", ".celestia-light",
"start",
"--headers.trusted-peer",
"/ip4/192.167.10.6/tcp/2121/p2p/12D3KooWL8z3KARAYJcmExhDsGwKbjChKeGaJpFPENyADdxmEHzw",
"--headers.trusted-hash",
"54A8B66D2BEF13850D67C8D474E196BD7485FE5A79989E31B17169371B0A9C96",
})
err := rootCmd.ExecuteContext(cmdnode.WithEnv(context.Background()))
require.NoError(t, err)
t.Cleanup(func() {
if err := os.Chdir(testDir); err != nil {
t.Error("error resetting:", err)
}
})

// TODO @jbowen93: Commented out until a dry-run option can be implemented
/*
t.Run("start", func(t *testing.T) {
output := &bytes.Buffer{}
rootCmd.SetOut(output)
rootCmd.SetArgs([]string{
"light",
"--node.store", ".celestia-light",
"start",
"--headers.trusted-peer",
"/ip4/192.167.10.6/tcp/2121/p2p/12D3KooWL8z3KARAYJcmExhDsGwKbjChKeGaJpFPENyADdxmEHzw",
"--headers.trusted-hash",
"54A8B66D2BEF13850D67C8D474E196BD7485FE5A79989E31B17169371B0A9C96",
})
err := rootCmd.ExecuteContext(cmdnode.WithEnv(context.Background()))
require.NoError(t, err)
})
*/
}

Expand All @@ -59,38 +65,43 @@ func TestBridge(t *testing.T) {
require.NoError(t, err, "error creating a temporary test directory")
testDir, err := os.Getwd()
require.NoError(t, err, "error getting the current working directory")
defer os.Chdir(testDir)
err = os.Chdir(tmpDir)
require.NoError(t, err, "error changing to the temporary test directory")

t.Run("init", func(t *testing.T) {
output := &bytes.Buffer{}
rootCmd.SetOut(output)
rootCmd.SetArgs([]string{
"bridge",
"bridge",
"--node.store", ".celestia-bridge",
"init",
})
err := rootCmd.ExecuteContext(cmdnode.WithEnv(context.Background()))
require.NoError(t, err)
})

// Commented out until a dry-run option can be implemented
/*
t.Run("start", func(t *testing.T) {
output := &bytes.Buffer{}
rootCmd.SetOut(output)
rootCmd.SetArgs([]string{
"bridge",
"--node.store", ".celestia-bridge",
"start",
"--core.remote",
"tcp://192.167.10.2:26657",
"--headers.trusted-hash",
"54A8B66D2BEF13850D67C8D474E196BD7485FE5A79989E31B17169371B0A9C96",
})
err := rootCmd.ExecuteContext(cmdnode.WithEnv(context.Background()))
require.NoError(t, err)
t.Cleanup(func() {
if err := os.Chdir(testDir); err != nil {
t.Error("error resetting:", err)
}
})

// TODO @jbowen93: Commented out until a dry-run option can be implemented
/*
t.Run("start", func(t *testing.T) {
output := &bytes.Buffer{}
rootCmd.SetOut(output)
rootCmd.SetArgs([]string{
"bridge",
"--node.store", ".celestia-bridge",
"start",
"--core.remote",
"tcp://192.167.10.2:26657",
"--headers.trusted-hash",
"54A8B66D2BEF13850D67C8D474E196BD7485FE5A79989E31B17169371B0A9C96",
})
err := rootCmd.ExecuteContext(cmdnode.WithEnv(context.Background()))
require.NoError(t, err)
})
*/
}

0 comments on commit f185ff3

Please sign in to comment.