From: Timo Tietavainen Date: Wed, 13 Oct 2021 18:57:25 +0000 (+0300) Subject: Fix integer to string conversion X-Git-Tag: entities/v1.2.3~3 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=19a86aa9cc884691eeeb5c0b05dc5f5c70f8a6e4;p=ric-plt%2Fnodeb-rnib.git Fix integer to string conversion Nodeb-rnib unit tests were failing due to illegal integer to string conversion, when unit tests were tried to run with Golang 1.6 version. There has been made some updates to string conversion function in newer Golang version, because string conversion passes with Golang 1.12. With this commit change problematic string() conversion function to strconv.FormatInt(), which works both with the Golang 1.12 and also newer versions. Update also ca-certificates, because they are out-dated in the Ubuntu 18 Docker builder base image. Fix ci/build export directory creation in Docker image, it should be created under root directory, not under /tmp directory. Bump sdlgo version to v0.8.0. Issue-Id: RIC-836 Signed-off-by: Timo Tietavainen Change-Id: I6e0bad9defd953b286d1e645d543ebf68b4475bf --- diff --git a/ci/Dockerfile b/ci/Dockerfile index 848ce9e..85a4383 100755 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -16,6 +16,13 @@ FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu18-c-go:1.9.0 as ubuntu RUN apt-get update && apt-get -q -y install cmake ksh alien + +# Update CA certificates +RUN apt update && apt install --reinstall -y \ + ca-certificates \ + && \ + update-ca-certificates + ADD . /tmp WORKDIR /tmp diff --git a/ci/build.sh b/ci/build.sh index 0f322e7..f31cd7c 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -34,11 +34,10 @@ fi new_name=${project_name}_$ver echo $new_names dpkg-deb --build $target_dir - mkdir -p export + mkdir -p /export echo "mv *.deb $new_name.deb" mv *.deb $new_name.deb echo "deb package is: $project_name_$ver.deb" ls -al *.deb - \ No newline at end of file diff --git a/creader/go.mod b/creader/go.mod index bd9276d..db39ebe 100644 --- a/creader/go.mod +++ b/creader/go.mod @@ -6,7 +6,7 @@ require ( gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.35 gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.35 gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.35 - gerrit.o-ran-sc.org/r/ric-plt/sdlgo v0.7.0 + gerrit.o-ran-sc.org/r/ric-plt/sdlgo v0.8.0 ) -replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.7.0 +replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.8.0 diff --git a/creader/go.sum b/creader/go.sum index 26bafd0..836bd08 100644 --- a/creader/go.sum +++ b/creader/go.sum @@ -4,8 +4,8 @@ gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.35 h1:tkM3yE8UzmuH4nf gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.35/go.mod h1:G+4sUBMbLfQ+RrGS65U15tKmbnP+/1b5oLTPmMfyfT4= gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.35 h1:LcxnUUDwsCzYEISKmkjkyYfg/lnLt8ofkPiGK69vNIA= gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.35/go.mod h1:2bSaXTpECbZieB8bMnubTqMwF3n+mMBxlTaAXvcduNg= -gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.7.0 h1:mxlBo54jxwHHFmGYzFI+fBIkOGwarQP4dx2KBxQ8ln8= -gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.7.0/go.mod h1:KCHu4JkWnw2Ro6P747wU9S2t7zxFLmBNCiYvGZo3CHo= +gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.8.0 h1:H7GtCRC+pGn6oOxYalUZr7LinQX5jQCVa+ConX7PB5Q= +gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.8.0/go.mod h1:KCHu4JkWnw2Ro6P747wU9S2t7zxFLmBNCiYvGZo3CHo= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= diff --git a/reader/go.mod b/reader/go.mod index 7f91832..5256ea7 100644 --- a/reader/go.mod +++ b/reader/go.mod @@ -5,7 +5,6 @@ go 1.12 require ( gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.2.1 gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.1 - gerrit.o-ran-sc.org/r/ric-plt/sdlgo v0.7.0 github.com/golang/protobuf v1.4.2 github.com/google/go-cmp v0.4.1 // indirect github.com/pkg/errors v0.8.1 @@ -16,4 +15,4 @@ replace gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common => ../common replace gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities => ../entities -replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.7.0 +replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.8.0 diff --git a/reader/rNibReaderDeprecated_test.go b/reader/rNibReaderDeprecated_test.go index 168432e..71757ff 100644 --- a/reader/rNibReaderDeprecated_test.go +++ b/reader/rNibReaderDeprecated_test.go @@ -27,6 +27,7 @@ import ( "github.com/golang/protobuf/proto" "github.com/pkg/errors" "github.com/stretchr/testify/assert" + "strconv" "testing" "time" ) @@ -431,7 +432,13 @@ func TestGetListEnbIdsDeprecated(t *testing.T) { idsData := make([]string, listSize) idsEntities := make([]*entities.NbIdentity, listSize) for i := 0; i < listSize; i++ { - nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: string(plmnId + i), NbId: string(nbId + i)}} + nbIdentity := &entities.NbIdentity{ + InventoryName: name, + GlobalNbId: &entities.GlobalNbId{ + PlmnId: strconv.FormatInt(int64(plmnId+i), 16), + NbId: strconv.FormatInt(int64(nbId+i), 16), + }, + } data, err := proto.Marshal(nbIdentity) if err != nil { t.Errorf("#rNibReader_test.TestGetListEnbIds - Failed to marshal nodeb identity entity. Error: %v", err) @@ -489,7 +496,13 @@ func TestGetListGnbIdsDeprecated(t *testing.T) { idsData := make([]string, listSize) idsEntities := make([]*entities.NbIdentity, listSize) for i := 0; i < listSize; i++ { - nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: string(plmnId + i), NbId: string(nbId + i)}} + nbIdentity := &entities.NbIdentity{ + InventoryName: name, + GlobalNbId: &entities.GlobalNbId{ + PlmnId: strconv.FormatInt(int64(plmnId+i), 16), + NbId: strconv.FormatInt(int64(nbId+i), 16), + }, + } data, err := proto.Marshal(nbIdentity) if err != nil { t.Errorf("#rNibReader_test.TestGetListGnbIds - Failed to marshal nodeb identity entity. Error: %v", err) diff --git a/reader/rNibReader_test.go b/reader/rNibReader_test.go index dea8970..caf35e3 100644 --- a/reader/rNibReader_test.go +++ b/reader/rNibReader_test.go @@ -27,6 +27,7 @@ import ( "github.com/golang/protobuf/proto" "github.com/pkg/errors" "github.com/stretchr/testify/assert" + "strconv" "testing" "time" ) @@ -432,7 +433,13 @@ func TestGetListEnbIds(t *testing.T) { idsData := make([]string, listSize) idsEntities := make([]*entities.NbIdentity, listSize) for i := 0; i < listSize; i++ { - nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: string(plmnId + i), NbId: string(nbId + i)}} + nbIdentity := &entities.NbIdentity{ + InventoryName: name, + GlobalNbId: &entities.GlobalNbId{ + PlmnId: strconv.FormatInt(int64(plmnId+i), 16), + NbId: strconv.FormatInt(int64(nbId+i), 16), + }, + } data, err := proto.Marshal(nbIdentity) if err != nil { t.Errorf("#rNibReader_test.TestGetListEnbIds - Failed to marshal nodeb identity entity. Error: %v", err) @@ -490,7 +497,13 @@ func TestGetListGnbIds(t *testing.T) { idsData := make([]string, listSize) idsEntities := make([]*entities.NbIdentity, listSize) for i := 0; i < listSize; i++ { - nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: string(plmnId + i), NbId: string(nbId + i)}} + nbIdentity := &entities.NbIdentity{ + InventoryName: name, + GlobalNbId: &entities.GlobalNbId{ + PlmnId: strconv.FormatInt(int64(plmnId+i), 16), + NbId: strconv.FormatInt(int64(nbId+i), 16), + }, + } data, err := proto.Marshal(nbIdentity) if err != nil { t.Errorf("#rNibReader_test.TestGetListGnbIds - Failed to marshal nodeb identity entity. Error: %v", err)