From 6389fa6a8e6fa67f8dde20ad48b4d96c260872e3 Mon Sep 17 00:00:00 2001 From: Paulo Canilho Date: Fri, 11 Mar 2022 22:45:03 +0100 Subject: [PATCH 01/12] Feature: Automated CI testing --- ci.Dockerfile | 5 ----- ci/TEST.gitlab-ci.yml | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) delete mode 100644 ci.Dockerfile diff --git a/ci.Dockerfile b/ci.Dockerfile deleted file mode 100644 index e6b6a2a..0000000 --- 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 863e660..540ed48 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: test + 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 & + - docker run --rm -e NEO4J_AUTH=${GONEO_USERNAME}/${GONEO_PASSWORD} -p 7687:7687 neo: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/... + - ./goneo.tests -- GitLab From 176be0bd6ed96cd2373d632df8745c5191bcaee3 Mon Sep 17 00:00:00 2001 From: Paulo Canilho Date: Fri, 11 Mar 2022 22:45:03 +0100 Subject: [PATCH 02/12] Feature: Automated CI testing --- .gitlab-ci.yml | 1 + ci/TEST.gitlab-ci.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a065369..bb48cbc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ image: golang:latest stages: + - build - test - doc diff --git a/ci/TEST.gitlab-ci.yml b/ci/TEST.gitlab-ci.yml index 540ed48..6002bf4 100644 --- a/ci/TEST.gitlab-ci.yml +++ b/ci/TEST.gitlab-ci.yml @@ -3,7 +3,7 @@ services: build-tests: image: golang:latest - stage: test + stage: build artifacts: paths: [goneo.tests] expire_in: 1 hour -- GitLab From 03c0f2d45748fa89b94f72bac9e9a7b93f3f2d94 Mon Sep 17 00:00:00 2001 From: Paulo Canilho Date: Fri, 11 Mar 2022 22:45:03 +0100 Subject: [PATCH 03/12] Feature: Automated CI testing --- ci/TEST.gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/TEST.gitlab-ci.yml b/ci/TEST.gitlab-ci.yml index 6002bf4..afd29f7 100644 --- a/ci/TEST.gitlab-ci.yml +++ b/ci/TEST.gitlab-ci.yml @@ -16,6 +16,6 @@ tests: image: docker:latest stage: test script: - - docker run --rm -e NEO4J_AUTH=${GONEO_USERNAME}/${GONEO_PASSWORD} -p 7687:7687 neo:latest neo4j & - - sleep 10 + - docker run --rm -e NEO4J_AUTH=${GONEO_USERNAME}/${GONEO_PASSWORD} -p 7687:7687 neo4j:4.4.4-community neo4j & + - sleep 2 - ./goneo.tests -- GitLab From 309a0bf55671ea79dcb94761b1a404add413644f Mon Sep 17 00:00:00 2001 From: Paulo Canilho Date: Fri, 11 Mar 2022 22:45:03 +0100 Subject: [PATCH 04/12] Feature: Automated CI testing --- ci/TEST.gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/TEST.gitlab-ci.yml b/ci/TEST.gitlab-ci.yml index afd29f7..368ddab 100644 --- a/ci/TEST.gitlab-ci.yml +++ b/ci/TEST.gitlab-ci.yml @@ -17,5 +17,5 @@ tests: stage: test script: - docker run --rm -e NEO4J_AUTH=${GONEO_USERNAME}/${GONEO_PASSWORD} -p 7687:7687 neo4j:4.4.4-community neo4j & - - sleep 2 - - ./goneo.tests + - sleep 10 + - ./goneo.tests -v -- GitLab From 52044f908ce522a5917daae5d41b0599efe840a0 Mon Sep 17 00:00:00 2001 From: Paulo Canilho Date: Fri, 11 Mar 2022 22:45:03 +0100 Subject: [PATCH 05/12] Feature: Automated CI testing --- ci/TEST.gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/TEST.gitlab-ci.yml b/ci/TEST.gitlab-ci.yml index 368ddab..d356108 100644 --- a/ci/TEST.gitlab-ci.yml +++ b/ci/TEST.gitlab-ci.yml @@ -18,4 +18,4 @@ tests: script: - docker run --rm -e NEO4J_AUTH=${GONEO_USERNAME}/${GONEO_PASSWORD} -p 7687:7687 neo4j:4.4.4-community neo4j & - sleep 10 - - ./goneo.tests -v + - ./goneo.tests -test.v -- GitLab From 0ecfb2441a000479ef6d84f32cdec84c2b5e87cd Mon Sep 17 00:00:00 2001 From: Paulo Canilho Date: Fri, 11 Mar 2022 22:45:03 +0100 Subject: [PATCH 06/12] Feature: Automated CI testing --- ci/TEST.gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/TEST.gitlab-ci.yml b/ci/TEST.gitlab-ci.yml index d356108..9b4960c 100644 --- a/ci/TEST.gitlab-ci.yml +++ b/ci/TEST.gitlab-ci.yml @@ -17,5 +17,5 @@ tests: stage: test script: - docker run --rm -e NEO4J_AUTH=${GONEO_USERNAME}/${GONEO_PASSWORD} -p 7687:7687 neo4j:4.4.4-community neo4j & - - sleep 10 + - sleep 30 - ./goneo.tests -test.v -- GitLab From e38ca1d3249c2ad4035719f335e07870791505ef Mon Sep 17 00:00:00 2001 From: Paulo Canilho Date: Fri, 11 Mar 2022 22:45:03 +0100 Subject: [PATCH 07/12] Feature: Automated CI testing --- ci/TEST.gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/TEST.gitlab-ci.yml b/ci/TEST.gitlab-ci.yml index 9b4960c..3bee2b3 100644 --- a/ci/TEST.gitlab-ci.yml +++ b/ci/TEST.gitlab-ci.yml @@ -17,5 +17,5 @@ tests: stage: test script: - docker run --rm -e NEO4J_AUTH=${GONEO_USERNAME}/${GONEO_PASSWORD} -p 7687:7687 neo4j:4.4.4-community neo4j & - - sleep 30 + - sleep 60 - ./goneo.tests -test.v -- GitLab From ba08632689b8c5c2d4d0cf4b1a473bee943a7fae Mon Sep 17 00:00:00 2001 From: Paulo Canilho Date: Fri, 11 Mar 2022 22:45:03 +0100 Subject: [PATCH 08/12] Feature: Automated CI testing --- ci/TEST.gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/TEST.gitlab-ci.yml b/ci/TEST.gitlab-ci.yml index 3bee2b3..2e3acbc 100644 --- a/ci/TEST.gitlab-ci.yml +++ b/ci/TEST.gitlab-ci.yml @@ -14,6 +14,8 @@ tests: dependencies: - build-tests image: docker:latest + services: + - docker:dind stage: test script: - docker run --rm -e NEO4J_AUTH=${GONEO_USERNAME}/${GONEO_PASSWORD} -p 7687:7687 neo4j:4.4.4-community neo4j & -- GitLab From 88321ae788a1a0743c6e31335815108a283cde8a Mon Sep 17 00:00:00 2001 From: Paulo Canilho Date: Fri, 11 Mar 2022 22:45:03 +0100 Subject: [PATCH 09/12] Feature: Automated CI testing --- ci/TEST.gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/ci/TEST.gitlab-ci.yml b/ci/TEST.gitlab-ci.yml index 2e3acbc..3bee2b3 100644 --- a/ci/TEST.gitlab-ci.yml +++ b/ci/TEST.gitlab-ci.yml @@ -14,8 +14,6 @@ tests: dependencies: - build-tests image: docker:latest - services: - - docker:dind stage: test script: - docker run --rm -e NEO4J_AUTH=${GONEO_USERNAME}/${GONEO_PASSWORD} -p 7687:7687 neo4j:4.4.4-community neo4j & -- GitLab From 2611bda145b384f5f3f69705c0bcded922a99517 Mon Sep 17 00:00:00 2001 From: Paulo Canilho Date: Fri, 11 Mar 2022 22:45:03 +0100 Subject: [PATCH 10/12] Feature: Automated CI testing --- reflector_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reflector_test.go b/reflector_test.go index b4289a1..012aef1 100644 --- a/reflector_test.go +++ b/reflector_test.go @@ -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' }`, }, } -- GitLab From 9b6eea2221540d993d49584695c2d775c87a8c51 Mon Sep 17 00:00:00 2001 From: Paulo Canilho Date: Fri, 11 Mar 2022 22:45:03 +0100 Subject: [PATCH 11/12] Feature: Automated CI testing --- reflector_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/reflector_test.go b/reflector_test.go index 012aef1..519ff49 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" }`, }, } -- GitLab From 35c13010e2394feeb143fef87d283904176f9146 Mon Sep 17 00:00:00 2001 From: Paulo Canilho Date: Fri, 11 Mar 2022 22:45:03 +0100 Subject: [PATCH 12/12] Feature: Automated CI testing --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 78cce3a..cc7a10e 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 -- GitLab