diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a065369d58697357f2c71d2d50117a1e239b8318..bb48cbca4e4ba64d2eaf7d1fd72cd70124201da0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ image: golang:latest stages: + - build - test - doc diff --git a/README.md b/README.md index 78cce3af82c1ca88feacee32abaf83230937d1e2..cc7a10e19bff09648ac1621ecf683e9095a674a7 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ A library that aims at implementing a [Neo4J](https://neo4j.com/) [ORM](shorturl - [x] `ORM` reflector that consumes arbitrary structs. - [x] CRUD controller for `Neo4J` engines. - [x] Custom `tags` to allow overriding of identifiers and library feature selection. -- [ ] `BDD` tests (ongoing). -- [ ] Automated `CI/CD` testing (ongoing). +- [x] Fully automated `CI` testing. +- [x] Full suite of `BDD` tests. ## How to use diff --git a/ci.Dockerfile b/ci.Dockerfile deleted file mode 100644 index e6b6a2ae1ee16e557e9fb7047db5c4bd6e13687a..0000000000000000000000000000000000000000 --- a/ci.Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM golang:latest AS init - -FROM neo4j:4.4.3-community -COPY --from=init /usr/local/go/bin/go /usr/local/bin/go -COPY --from=init /usr/local/go /usr/local/go \ No newline at end of file diff --git a/ci/TEST.gitlab-ci.yml b/ci/TEST.gitlab-ci.yml index 863e66048330be5a7c1018f5f386fb68155e6947..3bee2b3c874669d5836e061036f26027d22ed384 100644 --- a/ci/TEST.gitlab-ci.yml +++ b/ci/TEST.gitlab-ci.yml @@ -1,11 +1,21 @@ services: - docker:dind +build-tests: + image: golang:latest + stage: build + artifacts: + paths: [goneo.tests] + expire_in: 1 hour + script: + - go test -c -o goneo.tests + tests: + dependencies: + - build-tests image: docker:latest stage: test script: - - docker build -f ci.Dockerfile -t goneo:latest . - - docker run --rm -e NEO4J_AUTH=${GONEO_USERNAME}/${GONEO_PASSWORD} -p 7687:7687 goneo:latest neo4j & - - sleep 10 - - docker run -v $(pwd):/app --rm -e GONEO_ADDRESS -e GONEO_USERNAME -e GONEO_PASSWORD goneo:latest -- cd /app && go get ./... && go test -v /app/... + - docker run --rm -e NEO4J_AUTH=${GONEO_USERNAME}/${GONEO_PASSWORD} -p 7687:7687 neo4j:4.4.4-community neo4j & + - sleep 60 + - ./goneo.tests -test.v diff --git a/reflector_test.go b/reflector_test.go index b4289a18d2d783235e5fde4a330cf8d0d6629102..519ff49ecad8ba283704555badcda6fba8b71490 100644 --- a/reflector_test.go +++ b/reflector_test.go @@ -101,14 +101,14 @@ func TestORMFilter(t *testing.T) { Name: "test-filter-user", Email: "test-filter-user@domain.foo", }, - expected: "(user.name = 'test-filter-user') AND (user.email = 'test-filter-user@domain.foo')", + expected: `(user.name = "test-filter-user") AND (user.email = "test-filter-user@domain.foo")`, }, { in: User{ Name: "test-filter-user-2", Email: "test-filter-user-2@domain.foo", }, - expected: "(user.name = 'test-filter-user-2') AND (user.email = 'test-filter-user-2@domain.foo')", + expected: `(user.name = "test-filter-user-2") AND (user.email = "test-filter-user-2@domain.foo")`, }, } @@ -132,14 +132,14 @@ func TestORMFinder(t *testing.T) { Name: "test-filter-user", Email: "test-filter-user@domain.foo", }, - expected: "(user.name = 'test-filter-user') OR (user.email = 'test-filter-user@domain.foo')", + expected: `(user.name = "test-filter-user") OR (user.email = "test-filter-user@domain.foo")`, }, { in: User{ Name: "test-filter-user-2", Email: "test-filter-user-2@domain.foo", }, - expected: "(user.name = 'test-filter-user-2') OR (user.email = 'test-filter-user-2@domain.foo')", + expected: `(user.name = "test-filter-user-2") OR (user.email = "test-filter-user-2@domain.foo")`, }, } @@ -173,14 +173,14 @@ func TestORMEncodingMarshal(t *testing.T) { Name: "test-orm", Email: "test-orm@domain.foo", }, - expected: "{ name: 'test-orm', email: 'test-orm@domain.foo' }", + expected: `{ name: "test-orm", email: "test-orm@domain.foo" }`, }, { in: &User{ Name: "test-orm-ptr", Email: "test-orm-ptr@domain.foo", }, - expected: "{ name: 'test-orm-ptr', email: 'test-orm-ptr@domain.foo' }", + expected: `{ name: "test-orm-ptr", email: "test-orm-ptr@domain.foo" }`, }, }