From 9c16b9e63117bf1237585009b7199e9d5ea50778 Mon Sep 17 00:00:00 2001 From: Silvin Lubecki <31478878+silvin-lubecki@users.noreply.github.com> Date: Thu, 11 Apr 2019 18:31:56 +0200 Subject: [PATCH] Update action.Action interface, regarding the implementations changes (#687) Add static guards to check the actions implements the interface. Signed-off-by: Silvin Lubecki --- pkg/action/action.go | 2 +- pkg/action/install_test.go | 3 +++ pkg/action/run_custom_test.go | 3 +++ pkg/action/status_test.go | 3 +++ pkg/action/uninstall_test.go | 3 +++ pkg/action/upgrade_test.go | 3 +++ 6 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pkg/action/action.go b/pkg/action/action.go index 52d61dc0..adea8e04 100644 --- a/pkg/action/action.go +++ b/pkg/action/action.go @@ -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) { diff --git a/pkg/action/install_test.go b/pkg/action/install_test.go index ca6d0cdc..7607438b 100644 --- a/pkg/action/install_test.go +++ b/pkg/action/install_test.go @@ -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 diff --git a/pkg/action/run_custom_test.go b/pkg/action/run_custom_test.go index 3877d4ef..068c5205 100644 --- a/pkg/action/run_custom_test.go +++ b/pkg/action/run_custom_test.go @@ -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) diff --git a/pkg/action/status_test.go b/pkg/action/status_test.go index 62464c53..35a4e70a 100644 --- a/pkg/action/status_test.go +++ b/pkg/action/status_test.go @@ -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 diff --git a/pkg/action/uninstall_test.go b/pkg/action/uninstall_test.go index b855edb4..e98e3de8 100644 --- a/pkg/action/uninstall_test.go +++ b/pkg/action/uninstall_test.go @@ -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 diff --git a/pkg/action/upgrade_test.go b/pkg/action/upgrade_test.go index 277dabdc..b16c7aee 100644 --- a/pkg/action/upgrade_test.go +++ b/pkg/action/upgrade_test.go @@ -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