Skip to content

Commit

Permalink
Use /usr/local/bin on Flatcar (#460)
Browse files Browse the repository at this point in the history
* Use /usr/local/bin on Flatcar

Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
  • Loading branch information
kke committed Feb 8, 2023
1 parent c76ebf9 commit 7801b9a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 0 additions & 4 deletions configurer/linux/flatcar.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,3 @@ func init() {
func (l Flatcar) InstallPackage(h os.Host, pkg ...string) error {
return errors.New("FlatcarContainerLinux does not support installing packages manually")
}

func (l Flatcar) K0sBinaryPath() string {
return "/opt/bin/k0s"
}
15 changes: 13 additions & 2 deletions configurer/linux/linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/k0sproject/k0sctl/configurer"
"github.com/k0sproject/rig/exec"
"github.com/k0sproject/rig/os"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -44,9 +45,19 @@ func (m mockHost) Sudo(string) (string, error) {
return "", nil
}

// TestPaths tests the slightly weird way to perform function overloading
type custompaths struct {
BaseLinux
}

func (l custompaths) InstallPackage(_ os.Host, pkg ...string) error {
return nil
}
func (l custompaths) K0sBinaryPath() string {
return "/opt/bin/k0s"
}

func TestPaths(t *testing.T) {
fc := &Flatcar{}
fc := &custompaths{}
fc.PathFuncs = interface{}(fc).(configurer.PathFuncs)

ubuntu := &Ubuntu{}
Expand Down

0 comments on commit 7801b9a

Please sign in to comment.