From: subhash kumar singh Date: Mon, 14 Nov 2022 09:07:22 +0000 (+0000) Subject: Enable test cases to execute X-Git-Tag: 2.0.0~7 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=d6fcfc287d573d94e54a8116a0fc414fe5349a1a;hp=f95c1d3a137db6a4dd4ff7d8c3a8f5a2a7a55c2f;p=ric-plt%2Fricdms.git Enable test cases to execute - Enabled test cases to execute for build validation. - Fixed test case. Signed-off-by: subhash kumar singh Change-Id: I6b520a9500cb4dd9de5d1ca1c0feeb5d6850d1ee --- diff --git a/Dockerfile b/Dockerfile index 3321629..0648d88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,7 +54,8 @@ RUN /go/bin/swagger generate server -f api/ric-dms-api-2.0.yaml -t pkg/ --exclud RUN go build -a -installsuffix cgo -o /go/src/ws/cache/go/cmd/ric-dms cmd/ric-dms.go # Run unit tests -#RUN GO111MODULE=on GO_ENABLED=0 GOOS=linux go test -p 1 -cover ./pkg/resthooks/ +ENV RIC_DMS_CONFIG_FILE=/go/src/ws/config/config-test.yaml +RUN go test -p 1 -cover ./pkg/resthooks/ RUN gofmt -l $(find cmd/ pkg/ -name '*.go' -not -name '*_test.go') diff --git a/pkg/resthooks/resthooks_test.go b/pkg/resthooks/resthooks_test.go index 39ff3f3..991fbec 100644 --- a/pkg/resthooks/resthooks_test.go +++ b/pkg/resthooks/resthooks_test.go @@ -126,8 +126,9 @@ func TestGetCharts(t *testing.T) { resp := rh.GetCharts() assert.NotEqual(t, nil, resp) - successResp := resp.(*charts.GetChartsListOK) - assert.Equal(t, "SAMPLE_RESPONSE", successResp.Payload) + if _, ok := resp.(*charts.GetChartsListOK); !ok { + assert.Fail(t, "response type did not match : %t", resp) + } } func TestDownloadChart(t *testing.T) {