28 lines
615 B
Go
28 lines
615 B
Go
|
package helm
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"path/filepath"
|
||
|
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
type MockCommandStatus HelmCommandData
|
||
|
|
||
|
func TestHelmStatus(t *testing.T){
|
||
|
|
||
|
hs := HelmStatus{Name: "oc-catalog"}
|
||
|
hs.NewMock(MockCommandStatus{})
|
||
|
|
||
|
data, _ := hs.getRessources()
|
||
|
assert.Equal(t, "StatefulSet", data["oc-catalog-oc-catalog"], "TestHelmStatus error")
|
||
|
}
|
||
|
|
||
|
// Mock
|
||
|
func (this MockCommandStatus) Status(name string) (string, error) {
|
||
|
fileName := filepath.Join(TEST_SRC_DIR, "helm_status.json")
|
||
|
data, _ := os.ReadFile(fileName)
|
||
|
return string(data), nil
|
||
|
}
|