oc-deploy/src/helm/ressources_test.go

28 lines
615 B
Go
Raw Normal View History

2024-09-06 16:08:05 +02:00
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
}