Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Update action.Action interface, regarding the implementations changes (
Browse files Browse the repository at this point in the history
…#687)

Add static guards to check the actions implements the interface.

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
  • Loading branch information
silvin-lubecki authored and radu-matei committed Apr 11, 2019
1 parent 3ed3dbe commit 9c16b9e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/action/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const stateful = false
// - status
type Action interface {
// Run an action, and record the status in the given claim
Run(*claim.Claim, credentials.Set) error
Run(*claim.Claim, credentials.Set, io.Writer) error
}

func selectInvocationImage(d driver.Driver, c *claim.Claim) (bundle.InvocationImage, error) {
Expand Down
3 changes: 3 additions & 0 deletions pkg/action/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import (
"github.com/stretchr/testify/assert"
)

// makes sure Install implements Action interface
var _ Action = &Install{}

func TestInstall_Run(t *testing.T) {
out := ioutil.Discard

Expand Down
3 changes: 3 additions & 0 deletions pkg/action/run_custom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import (
"github.com/stretchr/testify/assert"
)

// makes sure RunCustom implements Action interface
var _ Action = &RunCustom{}

func TestRunCustom(t *testing.T) {
out := ioutil.Discard
is := assert.New(t)
Expand Down
3 changes: 3 additions & 0 deletions pkg/action/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import (
"github.com/stretchr/testify/assert"
)

// makes sure Status implements Action interface
var _ Action = &Status{}

func TestStatus_Run(t *testing.T) {
out := ioutil.Discard

Expand Down
3 changes: 3 additions & 0 deletions pkg/action/uninstall_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import (
"github.com/stretchr/testify/assert"
)

// makes sure Uninstall implements Action interface
var _ Action = &Uninstall{}

func TestUninstall_Run(t *testing.T) {
out := ioutil.Discard

Expand Down
3 changes: 3 additions & 0 deletions pkg/action/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import (
"github.com/stretchr/testify/assert"
)

// makes sure Upgrade implements Action interface
var _ Action = &Upgrade{}

func TestUpgrade_Run(t *testing.T) {
out := ioutil.Discard

Expand Down

0 comments on commit 9c16b9e

Please sign in to comment.