-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
609 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package commands | ||
|
||
import ( | ||
"github.com/loilo-inc/canarycage/cli/cage/upgrade" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
func (c *CageCommands) Upgrade( | ||
upgrader upgrade.Upgrader, | ||
) *cli.Command { | ||
var preRelease bool | ||
return &cli.Command{ | ||
Name: "upgrade", | ||
Usage: "upgrade cage binary with the latest version", | ||
Flags: []cli.Flag{ | ||
&cli.BoolFlag{ | ||
Name: "pre-release", | ||
Usage: "include pre-release versions", | ||
Destination: &preRelease, | ||
}, | ||
}, | ||
Action: func(ctx *cli.Context) error { | ||
return upgrader.Upgrade(&upgrade.Input{ | ||
PreRelease: preRelease, | ||
}) | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package commands_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/golang/mock/gomock" | ||
"github.com/loilo-inc/canarycage/cli/cage/commands" | ||
"github.com/loilo-inc/canarycage/cli/cage/upgrade" | ||
"github.com/loilo-inc/canarycage/mocks/mock_upgrade" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
func TestUpgrade(t *testing.T) { | ||
t.Run("Upgrade", func(t *testing.T) { | ||
app := cli.NewApp() | ||
ctrl := gomock.NewController(t) | ||
u := mock_upgrade.NewMockUpgrader(ctrl) | ||
u.EXPECT().Upgrade( | ||
gomock.Eq(&upgrade.Input{}), | ||
).Return(nil) | ||
cmds := commands.NewCageCommands(nil, nil) | ||
app.Commands = []*cli.Command{ | ||
cmds.Upgrade(u), | ||
} | ||
err := app.Run([]string{"cage", "upgrade"}) | ||
assert.NoError(t, err) | ||
}) | ||
t.Run("Upgrade with pre-release", func(t *testing.T) { | ||
app := cli.NewApp() | ||
ctrl := gomock.NewController(t) | ||
u := mock_upgrade.NewMockUpgrader(ctrl) | ||
u.EXPECT().Upgrade( | ||
gomock.Eq(&upgrade.Input{PreRelease: true}), | ||
).Return(nil) | ||
cmds := commands.NewCageCommands(nil, nil) | ||
app.Commands = []*cli.Command{ | ||
cmds.Upgrade(u), | ||
} | ||
err := app.Run([]string{"cage", "upgrade", "--pre-release"}) | ||
assert.NoError(t, err) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package upgrade | ||
|
||
type ExportedUpgrader = upgrader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1.0 |
2 changes: 2 additions & 0 deletions
2
cli/cage/upgrade/testdata/0.1.0/canarycage_0.1.0_checksums.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
e00aeaebd63dc17194891514411426aa50ec51b1095fe85df927106184c71b47 canarycage_darwin_arm64.zip | ||
e00aeaebd63dc17194891514411426aa50ec51b1095fe85df927106184c71b47 canarycage_linux_amd64.zip |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.2.0 |
2 changes: 2 additions & 0 deletions
2
cli/cage/upgrade/testdata/0.2.0/canarycage_0.2.0_checksums.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
4ec51ab19c8663c7a90d42eaab7e46e84fc0a227341b70a1ac7a24a311bc3e5a canarycage_darwin_arm64.zip | ||
4ec51ab19c8663c7a90d42eaab7e46e84fc0a227341b70a1ac7a24a311bc3e5a canarycage_linux_amd64.zip |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.2.1-rc1 |
2 changes: 2 additions & 0 deletions
2
cli/cage/upgrade/testdata/0.2.1-rc1/canarycage_0.2.1-rc1_checksums.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
867eaaeb40483a0ed532fa6474691134c8a5f6c99468e70a3603d65e4018a185 canarycage_darwin_arm64.zip | ||
867eaaeb40483a0ed532fa6474691134c8a5f6c99468e70a3603d65e4018a185 canarycage_linux_amd64.zip |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.