Skip to content

Commit

Permalink
client: improved returns, debugging output (#593)
Browse files Browse the repository at this point in the history
* client: rework function returns to remove http.Response

* client: split out UserClient

* client: add debugging output

* deps: update to include gorilla/[email protected]

* daemon: correct /logs response message

* docs: fix incorrect /logs documentation, regenerate tip documentation

* ci: build daemon with tag 'test',  fix bootstrap test to use version 'test'

closes #236
  • Loading branch information
bobheadxi authored Feb 27, 2019
1 parent 9d630eb commit 0d87ad0
Show file tree
Hide file tree
Showing 80 changed files with 1,526 additions and 911 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
install:
- go get github.com/golang/dep/cmd/dep
- dep ensure -v # cache vendor
- make daemon # cache daemon image
- make daemon TAG=test # cache daemon image
- make web-deps # cache node_modules

############################
Expand Down
74 changes: 30 additions & 44 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

[[constraint]]
name = "github.com/gorilla/websocket"
version = "1.2.0"
version = "1.4.0"

[[constraint]]
name = "github.com/aws/aws-sdk-go"
Expand Down
5 changes: 3 additions & 2 deletions client/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Use 'inertia %s logs' to check on the daemon's setup progress.

// Output deploy key to user
fmt.Fprintf(out, ">> GitHub Deploy Key (add to https://www.github.com/%s/settings/keys/new):\n", repo)
fmt.Fprint(out, pub.String()+"\n")
fmt.Fprint(out, pub+"\n")

// Output Webhook url to user
var addr, _ = c.Remote.DaemonAddr()
Expand All @@ -69,6 +69,7 @@ verify.`, repo, addr, c.Remote.Daemon.WebHookSecret)
Inertia daemon successfully deployed! Add your webhook url and deploy key to
your repository to enable continuous deployment.
Then run 'inertia %s up' to deploy your application.`, name)
Then run 'inertia %s up' to deploy your application.
`, name)
return nil
}
16 changes: 9 additions & 7 deletions client/bootstrap/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package bootstrap

import (
"net/http"
"context"
"os"
"testing"
"time"
Expand All @@ -17,7 +17,8 @@ import (

func newIntegrationClient() *client.Client {
remote := &cfg.Remote{
IP: "127.0.0.1",
Version: "test",
IP: "127.0.0.1",
SSH: &cfg.SSH{
IdentityFile: "../../test/keys/id_rsa",
User: "root",
Expand All @@ -28,8 +29,9 @@ func newIntegrationClient() *client.Client {
},
}
return client.NewClient(remote, client.Options{
SSH: runner.SSHOptions{},
Out: os.Stdout,
SSH: runner.SSHOptions{},
Out: os.Stdout,
Debug: true,
})
}

Expand All @@ -39,13 +41,13 @@ func TestBootstrap_Integration(t *testing.T) {
}

var c = newIntegrationClient()
assert.NoError(t, SetUpRemote(os.Stdout, "test", "", c))
assert.NoError(t, SetUpRemote(os.Stdout, "test-remote", "", c))

// Daemon setup takes a bit of time - do a crude wait
time.Sleep(3 * time.Second)

// Check if daemon is online following bootstrap
resp, err := c.Status()
status, err := c.Status(context.Background())
assert.NoError(t, err)
assert.Equal(t, http.StatusOK, resp.StatusCode)
assert.Equal(t, "test", status.InertiaVersion)
}
Loading

0 comments on commit 0d87ad0

Please sign in to comment.