diff --git a/.github/codecov.yml b/.github/codecov.yml index 91f3171949..7289088f08 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -1,7 +1,7 @@ # Source Network's codecov configuration file. github_checks: - annotations: true + annotations: true codecov: require_ci_to_pass: yes @@ -31,13 +31,11 @@ coverage: changes: false - comment: layout: "reach, diff, files" behavior: default # update if exists else create new require_changes: true ignore: - - "bench" - - "db/tests" + - "tests" - "**/*_test.go" diff --git a/.github/workflows/lint-then-benchmark.yml b/.github/workflows/lint-then-benchmark.yml index e1aa03dfc5..1ae596cd95 100644 --- a/.github/workflows/lint-then-benchmark.yml +++ b/.github/workflows/lint-then-benchmark.yml @@ -1,6 +1,5 @@ name: Lint and then Benchmark - on: pull_request: @@ -11,22 +10,17 @@ on: - master - develop - ## These are the permissions for the lint check job. permissions: # Allow read access to pull request (Required for the `only-new-issues` option.) pull-requests: read contents: read - env: # This is the default benchmark type which if no labels are specified will be used. DEFAULT_BENCHMARK_TYPE: SHORT - jobs: - - # ========================================================= Step-1: Run the lint check. golangci: name: Lint Check @@ -44,7 +38,7 @@ jobs: - name: Setup Go environment explicitly uses: actions/setup-go@v3 with: - go-version: '1.17' + go-version: "1.17" check-latest: true - name: Run the golangci-lint @@ -65,7 +59,7 @@ jobs: # indicating that the linter ran successfully (weather or not linter errors # exist or not doesn't matter). But the good think is that the annotations # will still show up. I think this can be useful if we don't want the pipeline - # to stop just because we had some linter errors. + # to stop just because we had some linter errors. args: --issues-exit-code=1 --config tools/configs/golangci.yaml # Optional: we can set the below to `true` if we only want to see newly @@ -77,7 +71,6 @@ jobs: # always have a clean lint state. only-new-issues: false - # =================== Step-2: Decide what type of benchmarks to run based on label(s). # This job acts like a switch to simplify our ci control flow later on. decide-benchmark-type: @@ -117,7 +110,6 @@ jobs: id: set-benchmark-type run: echo "::set-output name=type::${DEFAULT_BENCHMARK_TYPE}" - # ================== Step-3: Start the runner and get it registered as a github runner. start-runner: name: Start self-hosted EC2 runner @@ -159,7 +151,6 @@ jobs: ## {"Key": "GitHubRepository", "Value": "${{ github.repository }}"} ## ] - # =========================== Step-4: Run the benchmarks on the runner we just started. benchmark-ec2-runner: name: Run the benchmarks on the started EC2 runner @@ -210,7 +201,7 @@ jobs: # ------------- Download & Compare - If PR going into develop - # To find the latest commit on remote develop branch we essentially + # To find the latest commit on remote develop branch we essentially # just need to do the following: # >> git fetch origin develop > /dev/null 2>&1 \ # && git rev-parse origin/develop @@ -240,16 +231,24 @@ jobs: branch: develop name: bench-artifact-${{ steps.last_successful_upload_on_develop.outputs.commit_hash }} repo: ${{ github.repository }} - check_artifacts: false + check_artifacts: false search_artifacts: false - - name: Run the benchmark comparisons + - name: Prepare benchmark reports for comparisons if: | github.event_name == 'pull_request' && github.base_ref == 'develop' run: > make deps:bench && cp bench-artifact-${{ steps.last_successful_upload_on_develop.outputs.commit_hash }}.txt develop.txt && + sed -i '/^pkg: /s/^pkg:\ .*\/bench\//pkg:\ /g' develop.txt && + sed -i '/^pkg: /s/^pkg:\ .*\/bench\//pkg:\ /g' current.txt + + - name: Run the benchmark comparisons + if: | + github.event_name == 'pull_request' && + github.base_ref == 'develop' + run: > ${GOPATH}/bin/benchstat -html -alpha 1.1 develop.txt current.txt | sed -n "//,/<\/body>/p" > comparison.html && ./tools/scripts/pretty-benchstat-html.sh comparison.html > pretty-comparison.md @@ -263,7 +262,6 @@ jobs: with: path: pretty-comparison.md - # =============================== Step-5: Stop the runner once the benchmarks have ran. stop-runner: name: Stop self-hosted EC2 runner diff --git a/.gitignore b/.gitignore index 7dc09fb274..18d96749e8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,6 @@ build/defradb* cover.out coverage-full.txt coverage-quick.txt -bench/*.log -bench/*.svg +tests/bench/*.log +tests/bench/*.svg .vscode \ No newline at end of file diff --git a/Makefile b/Makefile index 13a382183a..60c927c519 100644 --- a/Makefile +++ b/Makefile @@ -77,11 +77,11 @@ test\:clean: clean\:test test .PHONY: test\:bench test\:bench: - make -C ./bench/ bench + make -C ./tests/bench/ bench .PHONY: test\:bench-short test\:bench-short: - make -C ./bench/ bench:short + make -C ./tests/bench/ bench:short # This also takes integration tests into account. .PHONY: test\:coverage-full diff --git a/bench/Makefile b/tests/bench/Makefile similarity index 100% rename from bench/Makefile rename to tests/bench/Makefile diff --git a/bench/README.md b/tests/bench/README.md similarity index 100% rename from bench/README.md rename to tests/bench/README.md diff --git a/bench/bench_util.go b/tests/bench/bench_util.go similarity index 97% rename from bench/bench_util.go rename to tests/bench/bench_util.go index d003a94146..48f28740d1 100644 --- a/bench/bench_util.go +++ b/tests/bench/bench_util.go @@ -23,10 +23,10 @@ import ( "github.com/dgraph-io/badger/v3" ds "github.com/ipfs/go-datastore" - "github.com/sourcenetwork/defradb/bench/fixtures" "github.com/sourcenetwork/defradb/client" - testutils "github.com/sourcenetwork/defradb/db/tests" "github.com/sourcenetwork/defradb/logging" + "github.com/sourcenetwork/defradb/tests/bench/fixtures" + testutils "github.com/sourcenetwork/defradb/tests/integration" ) const ( @@ -36,7 +36,7 @@ const ( var ( storage string = "memory" - log = logging.MustNewLogger("defra.bench") + log = logging.MustNewLogger("defra.tests.bench") ) func init() { diff --git a/bench/collection/simple_create_many_test.go b/tests/bench/collection/simple_create_many_test.go similarity index 94% rename from bench/collection/simple_create_many_test.go rename to tests/bench/collection/simple_create_many_test.go index 3edadbb7b8..4990e29eb0 100644 --- a/bench/collection/simple_create_many_test.go +++ b/tests/bench/collection/simple_create_many_test.go @@ -14,7 +14,7 @@ import ( "context" "testing" - "github.com/sourcenetwork/defradb/bench/fixtures" + "github.com/sourcenetwork/defradb/tests/bench/fixtures" ) func Benchmark_Collection_UserSimple_CreateMany_Sync_0_10(b *testing.B) { diff --git a/bench/collection/simple_create_test.go b/tests/bench/collection/simple_create_test.go similarity index 97% rename from bench/collection/simple_create_test.go rename to tests/bench/collection/simple_create_test.go index 70d9e247cb..836856d26c 100644 --- a/bench/collection/simple_create_test.go +++ b/tests/bench/collection/simple_create_test.go @@ -14,7 +14,7 @@ import ( "context" "testing" - "github.com/sourcenetwork/defradb/bench/fixtures" + "github.com/sourcenetwork/defradb/tests/bench/fixtures" ) func Benchmark_Collection_UserSimple_Create_Sync_0_1(b *testing.B) { diff --git a/bench/collection/simple_read_test.go b/tests/bench/collection/simple_read_test.go similarity index 98% rename from bench/collection/simple_read_test.go rename to tests/bench/collection/simple_read_test.go index 3a671ac52e..cbb745a860 100644 --- a/bench/collection/simple_read_test.go +++ b/tests/bench/collection/simple_read_test.go @@ -14,7 +14,7 @@ import ( "context" "testing" - "github.com/sourcenetwork/defradb/bench/fixtures" + "github.com/sourcenetwork/defradb/tests/bench/fixtures" ) func Benchmark_Collection_UserSimple_Read_Sync_1_1(b *testing.B) { diff --git a/bench/collection/utils.go b/tests/bench/collection/utils.go similarity index 98% rename from bench/collection/utils.go rename to tests/bench/collection/utils.go index 7beb84422a..ed0c8e1963 100644 --- a/bench/collection/utils.go +++ b/tests/bench/collection/utils.go @@ -17,9 +17,9 @@ import ( "sync" "testing" - benchutils "github.com/sourcenetwork/defradb/bench" - "github.com/sourcenetwork/defradb/bench/fixtures" "github.com/sourcenetwork/defradb/client" + benchutils "github.com/sourcenetwork/defradb/tests/bench" + "github.com/sourcenetwork/defradb/tests/bench/fixtures" ) const ( diff --git a/bench/fixtures/data.go b/tests/bench/fixtures/data.go similarity index 100% rename from bench/fixtures/data.go rename to tests/bench/fixtures/data.go diff --git a/bench/fixtures/fixtures.go b/tests/bench/fixtures/fixtures.go similarity index 100% rename from bench/fixtures/fixtures.go rename to tests/bench/fixtures/fixtures.go diff --git a/bench/query/planner/simple_test.go b/tests/bench/query/planner/simple_test.go similarity index 94% rename from bench/query/planner/simple_test.go rename to tests/bench/query/planner/simple_test.go index d74fd29d86..e911002911 100644 --- a/bench/query/planner/simple_test.go +++ b/tests/bench/query/planner/simple_test.go @@ -14,7 +14,7 @@ import ( "context" "testing" - "github.com/sourcenetwork/defradb/bench/fixtures" + "github.com/sourcenetwork/defradb/tests/bench/fixtures" ) var ( diff --git a/bench/query/planner/utils.go b/tests/bench/query/planner/utils.go similarity index 94% rename from bench/query/planner/utils.go rename to tests/bench/query/planner/utils.go index 3faa87029a..25b091e178 100644 --- a/bench/query/planner/utils.go +++ b/tests/bench/query/planner/utils.go @@ -15,10 +15,10 @@ import ( "fmt" "testing" - benchutils "github.com/sourcenetwork/defradb/bench" - "github.com/sourcenetwork/defradb/bench/fixtures" "github.com/sourcenetwork/defradb/query/graphql/planner" "github.com/sourcenetwork/defradb/query/graphql/schema" + benchutils "github.com/sourcenetwork/defradb/tests/bench" + "github.com/sourcenetwork/defradb/tests/bench/fixtures" ) func runQueryParserBench( diff --git a/bench/query/simple/simple_test.go b/tests/bench/query/simple/simple_test.go similarity index 96% rename from bench/query/simple/simple_test.go rename to tests/bench/query/simple/simple_test.go index 8c22cb25a7..ca0d627275 100644 --- a/bench/query/simple/simple_test.go +++ b/tests/bench/query/simple/simple_test.go @@ -14,7 +14,7 @@ import ( "context" "testing" - "github.com/sourcenetwork/defradb/bench/fixtures" + "github.com/sourcenetwork/defradb/tests/bench/fixtures" ) var ( diff --git a/bench/query/simple/utils.go b/tests/bench/query/simple/utils.go similarity index 96% rename from bench/query/simple/utils.go rename to tests/bench/query/simple/utils.go index 197d324623..29e44d4a2a 100644 --- a/bench/query/simple/utils.go +++ b/tests/bench/query/simple/utils.go @@ -17,9 +17,9 @@ import ( "strings" "testing" - benchutils "github.com/sourcenetwork/defradb/bench" - "github.com/sourcenetwork/defradb/bench/fixtures" "github.com/sourcenetwork/defradb/client" + benchutils "github.com/sourcenetwork/defradb/tests/bench" + "github.com/sourcenetwork/defradb/tests/bench/fixtures" ) var ( diff --git a/bench/query/simple/with_filter_test.go b/tests/bench/query/simple/with_filter_test.go similarity index 96% rename from bench/query/simple/with_filter_test.go rename to tests/bench/query/simple/with_filter_test.go index 5684a0a3a9..86323e2beb 100644 --- a/bench/query/simple/with_filter_test.go +++ b/tests/bench/query/simple/with_filter_test.go @@ -14,7 +14,7 @@ import ( "context" "testing" - "github.com/sourcenetwork/defradb/bench/fixtures" + "github.com/sourcenetwork/defradb/tests/bench/fixtures" ) var ( diff --git a/bench/query/simple/with_limit_offset_test.go b/tests/bench/query/simple/with_limit_offset_test.go similarity index 96% rename from bench/query/simple/with_limit_offset_test.go rename to tests/bench/query/simple/with_limit_offset_test.go index 2ffe6f30a0..97dc523455 100644 --- a/bench/query/simple/with_limit_offset_test.go +++ b/tests/bench/query/simple/with_limit_offset_test.go @@ -14,7 +14,7 @@ import ( "context" "testing" - "github.com/sourcenetwork/defradb/bench/fixtures" + "github.com/sourcenetwork/defradb/tests/bench/fixtures" ) var ( diff --git a/bench/query/simple/with_multi_lookup_test.go b/tests/bench/query/simple/with_multi_lookup_test.go similarity index 96% rename from bench/query/simple/with_multi_lookup_test.go rename to tests/bench/query/simple/with_multi_lookup_test.go index 449fc6bbf6..6af7b6e20a 100644 --- a/bench/query/simple/with_multi_lookup_test.go +++ b/tests/bench/query/simple/with_multi_lookup_test.go @@ -14,7 +14,7 @@ import ( "context" "testing" - "github.com/sourcenetwork/defradb/bench/fixtures" + "github.com/sourcenetwork/defradb/tests/bench/fixtures" ) var ( diff --git a/bench/query/simple/with_single_lookup_test.go b/tests/bench/query/simple/with_single_lookup_test.go similarity index 96% rename from bench/query/simple/with_single_lookup_test.go rename to tests/bench/query/simple/with_single_lookup_test.go index bce97e557a..a2fb7e3b59 100644 --- a/bench/query/simple/with_single_lookup_test.go +++ b/tests/bench/query/simple/with_single_lookup_test.go @@ -14,7 +14,7 @@ import ( "context" "testing" - "github.com/sourcenetwork/defradb/bench/fixtures" + "github.com/sourcenetwork/defradb/tests/bench/fixtures" ) var ( diff --git a/bench/query/simple/with_sort_test.go b/tests/bench/query/simple/with_sort_test.go similarity index 96% rename from bench/query/simple/with_sort_test.go rename to tests/bench/query/simple/with_sort_test.go index 13c4128c4f..ec1a757f2b 100644 --- a/bench/query/simple/with_sort_test.go +++ b/tests/bench/query/simple/with_sort_test.go @@ -14,7 +14,7 @@ import ( "context" "testing" - "github.com/sourcenetwork/defradb/bench/fixtures" + "github.com/sourcenetwork/defradb/tests/bench/fixtures" ) var ( diff --git a/bench/storage/get_test.go b/tests/bench/storage/get_test.go similarity index 100% rename from bench/storage/get_test.go rename to tests/bench/storage/get_test.go diff --git a/bench/storage/put_many_test.go b/tests/bench/storage/put_many_test.go similarity index 100% rename from bench/storage/put_many_test.go rename to tests/bench/storage/put_many_test.go diff --git a/bench/storage/put_test.go b/tests/bench/storage/put_test.go similarity index 100% rename from bench/storage/put_test.go rename to tests/bench/storage/put_test.go diff --git a/bench/storage/txn_get_test.go b/tests/bench/storage/txn_get_test.go similarity index 100% rename from bench/storage/txn_get_test.go rename to tests/bench/storage/txn_get_test.go diff --git a/bench/storage/txn_iterator_test.go b/tests/bench/storage/txn_iterator_test.go similarity index 100% rename from bench/storage/txn_iterator_test.go rename to tests/bench/storage/txn_iterator_test.go diff --git a/bench/storage/utils.go b/tests/bench/storage/utils.go similarity index 99% rename from bench/storage/utils.go rename to tests/bench/storage/utils.go index ac14922516..149c4fce54 100644 --- a/bench/storage/utils.go +++ b/tests/bench/storage/utils.go @@ -19,8 +19,8 @@ import ( ds "github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore/query" - benchutils "github.com/sourcenetwork/defradb/bench" "github.com/sourcenetwork/defradb/client" + benchutils "github.com/sourcenetwork/defradb/tests/bench" ) func runStorageBenchGet( diff --git a/db/tests/README.md b/tests/integration/README.md similarity index 52% rename from db/tests/README.md rename to tests/integration/README.md index 2cad0cc873..ccf39e7ab7 100644 --- a/db/tests/README.md +++ b/tests/integration/README.md @@ -1,20 +1,20 @@ -## Testing Guide +## Database Integration Testing Guide - We want to keep the mutation and query tests separate, here is what the folder structure looks like currently: ``` - db/tests + tests/integration ├── mutation/ └── query/ ``` -- Every immediate directory under `db/tests/mutation` and `db/tests/query` should ONLY contain +- Every immediate directory under `tests/integration/mutation` and `tests/integration/query` should ONLY contain a single schema. For example: -`db/tests/query/simple` and `db/tests/query/complex` have different schemas. +`tests/integration/query/simple` and `tests/integration/query/complex` have different schemas. - We can group different types of tests using the same schema into further sub-folders. For example: - - `db/tests/mutation/simple/create`: contains tests that + - `tests/integration/mutation/simple/create`: contains tests that use the `simple` schema to test only the create mutation. - - `db/tests/mutation/simple/mix`: contains test that use + - `tests/integration/mutation/simple/mix`: contains test that use the `simple` schema to test combination of mutations. diff --git a/db/tests/mutation/inline_array/update/simple_test.go b/tests/integration/mutation/inline_array/update/simple_test.go similarity index 98% rename from db/tests/mutation/inline_array/update/simple_test.go rename to tests/integration/mutation/inline_array/update/simple_test.go index 7fef60f500..1fdf03c301 100644 --- a/db/tests/mutation/inline_array/update/simple_test.go +++ b/tests/integration/mutation/inline_array/update/simple_test.go @@ -13,8 +13,8 @@ package update import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" - inlineArray "github.com/sourcenetwork/defradb/db/tests/mutation/inline_array" + testUtils "github.com/sourcenetwork/defradb/tests/integration" + inlineArray "github.com/sourcenetwork/defradb/tests/integration/mutation/inline_array" ) func TestMutationInlineArrayUpdateWithBooleans(t *testing.T) { diff --git a/db/tests/mutation/inline_array/utils.go b/tests/integration/mutation/inline_array/utils.go similarity index 92% rename from db/tests/mutation/inline_array/utils.go rename to tests/integration/mutation/inline_array/utils.go index 99e6529f9f..4ae75f221e 100644 --- a/db/tests/mutation/inline_array/utils.go +++ b/tests/integration/mutation/inline_array/utils.go @@ -13,7 +13,7 @@ package inline_array import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) var userCollectionGQLSchema = (` diff --git a/db/tests/mutation/relation/delete/single_id_test.go b/tests/integration/mutation/relation/delete/single_id_test.go similarity index 96% rename from db/tests/mutation/relation/delete/single_id_test.go rename to tests/integration/mutation/relation/delete/single_id_test.go index 6598cd061c..06da236fc6 100644 --- a/db/tests/mutation/relation/delete/single_id_test.go +++ b/tests/integration/mutation/relation/delete/single_id_test.go @@ -13,8 +13,8 @@ package relation_delete import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" - relationTests "github.com/sourcenetwork/defradb/db/tests/mutation/relation" + testUtils "github.com/sourcenetwork/defradb/tests/integration" + relationTests "github.com/sourcenetwork/defradb/tests/integration/mutation/relation" ) func TestRelationalDeletionOfADocumentUsingSingleKey_Success(t *testing.T) { diff --git a/db/tests/mutation/relation/utils.go b/tests/integration/mutation/relation/utils.go similarity index 93% rename from db/tests/mutation/relation/utils.go rename to tests/integration/mutation/relation/utils.go index 004d035e06..7f9b080353 100644 --- a/db/tests/mutation/relation/utils.go +++ b/tests/integration/mutation/relation/utils.go @@ -13,7 +13,7 @@ package relation import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) var bookAuthorPublisherGQLSchema = (` diff --git a/db/tests/mutation/simple/create/simple_test.go b/tests/integration/mutation/simple/create/simple_test.go similarity index 90% rename from db/tests/mutation/simple/create/simple_test.go rename to tests/integration/mutation/simple/create/simple_test.go index 5e5ec72d1b..898207f997 100644 --- a/db/tests/mutation/simple/create/simple_test.go +++ b/tests/integration/mutation/simple/create/simple_test.go @@ -13,8 +13,8 @@ package create import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" - simpleTests "github.com/sourcenetwork/defradb/db/tests/mutation/simple" + testUtils "github.com/sourcenetwork/defradb/tests/integration" + simpleTests "github.com/sourcenetwork/defradb/tests/integration/mutation/simple" ) func TestMutationCreateSimple(t *testing.T) { diff --git a/db/tests/mutation/simple/delete/multi_ids_test.go b/tests/integration/mutation/simple/delete/multi_ids_test.go similarity index 98% rename from db/tests/mutation/simple/delete/multi_ids_test.go rename to tests/integration/mutation/simple/delete/multi_ids_test.go index ceffee6c45..2196988c4c 100644 --- a/db/tests/mutation/simple/delete/multi_ids_test.go +++ b/tests/integration/mutation/simple/delete/multi_ids_test.go @@ -13,8 +13,8 @@ package delete import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" - simpleTests "github.com/sourcenetwork/defradb/db/tests/mutation/simple" + testUtils "github.com/sourcenetwork/defradb/tests/integration" + simpleTests "github.com/sourcenetwork/defradb/tests/integration/mutation/simple" ) func TestDeletionOfMultipleDocumentUsingMultipleKeys_Success(t *testing.T) { diff --git a/db/tests/mutation/simple/delete/single_id_test.go b/tests/integration/mutation/simple/delete/single_id_test.go similarity index 96% rename from db/tests/mutation/simple/delete/single_id_test.go rename to tests/integration/mutation/simple/delete/single_id_test.go index 9b992e8b3c..5d96fdb9cd 100644 --- a/db/tests/mutation/simple/delete/single_id_test.go +++ b/tests/integration/mutation/simple/delete/single_id_test.go @@ -13,8 +13,8 @@ package delete import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" - simpleTests "github.com/sourcenetwork/defradb/db/tests/mutation/simple" + testUtils "github.com/sourcenetwork/defradb/tests/integration" + simpleTests "github.com/sourcenetwork/defradb/tests/integration/mutation/simple" ) func TestDeletionOfADocumentUsingSingleKey_Success(t *testing.T) { diff --git a/db/tests/mutation/simple/delete/with_filter_test.go b/tests/integration/mutation/simple/delete/with_filter_test.go similarity index 97% rename from db/tests/mutation/simple/delete/with_filter_test.go rename to tests/integration/mutation/simple/delete/with_filter_test.go index d5b581fde9..4c7e169764 100644 --- a/db/tests/mutation/simple/delete/with_filter_test.go +++ b/tests/integration/mutation/simple/delete/with_filter_test.go @@ -13,8 +13,8 @@ package delete import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" - simpleTests "github.com/sourcenetwork/defradb/db/tests/mutation/simple" + testUtils "github.com/sourcenetwork/defradb/tests/integration" + simpleTests "github.com/sourcenetwork/defradb/tests/integration/mutation/simple" ) func TestDeletionOfDocumentsWithFilter_Success(t *testing.T) { diff --git a/db/tests/mutation/simple/mix/with_txn_test.go b/tests/integration/mutation/simple/mix/with_txn_test.go similarity index 97% rename from db/tests/mutation/simple/mix/with_txn_test.go rename to tests/integration/mutation/simple/mix/with_txn_test.go index cf653852c3..e372b68582 100644 --- a/db/tests/mutation/simple/mix/with_txn_test.go +++ b/tests/integration/mutation/simple/mix/with_txn_test.go @@ -13,8 +13,8 @@ package mix import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" - simpleTests "github.com/sourcenetwork/defradb/db/tests/mutation/simple" + testUtils "github.com/sourcenetwork/defradb/tests/integration" + simpleTests "github.com/sourcenetwork/defradb/tests/integration/mutation/simple" ) func TestMutationWithTxnDeletesUserGivenSameTransaction(t *testing.T) { diff --git a/db/tests/mutation/simple/update/with_filter_test.go b/tests/integration/mutation/simple/update/with_filter_test.go similarity index 96% rename from db/tests/mutation/simple/update/with_filter_test.go rename to tests/integration/mutation/simple/update/with_filter_test.go index 193c0a5223..fe80f9b1c2 100644 --- a/db/tests/mutation/simple/update/with_filter_test.go +++ b/tests/integration/mutation/simple/update/with_filter_test.go @@ -13,8 +13,8 @@ package update import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" - simpleTests "github.com/sourcenetwork/defradb/db/tests/mutation/simple" + testUtils "github.com/sourcenetwork/defradb/tests/integration" + simpleTests "github.com/sourcenetwork/defradb/tests/integration/mutation/simple" ) func TestSimpleMutationUpdateWithBooleanFilter(t *testing.T) { diff --git a/db/tests/mutation/simple/utils.go b/tests/integration/mutation/simple/utils.go similarity index 91% rename from db/tests/mutation/simple/utils.go rename to tests/integration/mutation/simple/utils.go index eab4735e22..f118846cd4 100644 --- a/db/tests/mutation/simple/utils.go +++ b/tests/integration/mutation/simple/utils.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) var userSchema = (` diff --git a/db/tests/query/all_commits/simple_test.go b/tests/integration/query/all_commits/simple_test.go similarity index 96% rename from db/tests/query/all_commits/simple_test.go rename to tests/integration/query/all_commits/simple_test.go index 520e414986..d7ab4fac64 100644 --- a/db/tests/query/all_commits/simple_test.go +++ b/tests/integration/query/all_commits/simple_test.go @@ -13,7 +13,7 @@ package all_commits import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryAllCommitsSingleDAG(t *testing.T) { diff --git a/db/tests/query/all_commits/utils.go b/tests/integration/query/all_commits/utils.go similarity index 91% rename from db/tests/query/all_commits/utils.go rename to tests/integration/query/all_commits/utils.go index ec9a0d1a72..b3a3590a49 100644 --- a/db/tests/query/all_commits/utils.go +++ b/tests/integration/query/all_commits/utils.go @@ -13,7 +13,7 @@ package all_commits import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) var userCollectionGQLSchema = (` diff --git a/db/tests/query/all_commits/with_count_test.go b/tests/integration/query/all_commits/with_count_test.go similarity index 93% rename from db/tests/query/all_commits/with_count_test.go rename to tests/integration/query/all_commits/with_count_test.go index e4dae4a8be..b68768f87f 100644 --- a/db/tests/query/all_commits/with_count_test.go +++ b/tests/integration/query/all_commits/with_count_test.go @@ -13,7 +13,7 @@ package all_commits import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryAllCommitsSingleDAGWithLinkCount(t *testing.T) { diff --git a/db/tests/query/commit/simple_test.go b/tests/integration/query/commit/simple_test.go similarity index 94% rename from db/tests/query/commit/simple_test.go rename to tests/integration/query/commit/simple_test.go index ea50a35d12..aca13cbf81 100644 --- a/db/tests/query/commit/simple_test.go +++ b/tests/integration/query/commit/simple_test.go @@ -13,7 +13,7 @@ package commit import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryOneCommit(t *testing.T) { diff --git a/db/tests/query/commit/utils.go b/tests/integration/query/commit/utils.go similarity index 91% rename from db/tests/query/commit/utils.go rename to tests/integration/query/commit/utils.go index d23fc97dff..298340511b 100644 --- a/db/tests/query/commit/utils.go +++ b/tests/integration/query/commit/utils.go @@ -13,7 +13,7 @@ package commit import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) var userCollectionGQLSchema = (` diff --git a/db/tests/query/complex/simple_test.go b/tests/integration/query/complex/simple_test.go similarity index 96% rename from db/tests/query/complex/simple_test.go rename to tests/integration/query/complex/simple_test.go index 13b7d380c0..bfa12c14e6 100644 --- a/db/tests/query/complex/simple_test.go +++ b/tests/integration/query/complex/simple_test.go @@ -13,7 +13,7 @@ package complex import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryComplex(t *testing.T) { diff --git a/db/tests/query/complex/utils.go b/tests/integration/query/complex/utils.go similarity index 93% rename from db/tests/query/complex/utils.go rename to tests/integration/query/complex/utils.go index 198ecee09e..1fee36db69 100644 --- a/db/tests/query/complex/utils.go +++ b/tests/integration/query/complex/utils.go @@ -13,7 +13,7 @@ package complex import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) var bookAuthorPublisherGQLSchema = (` diff --git a/db/tests/query/complex/with_sum_test.go b/tests/integration/query/complex/with_sum_test.go similarity index 95% rename from db/tests/query/complex/with_sum_test.go rename to tests/integration/query/complex/with_sum_test.go index 3f23d7ac3c..5f3c7b8430 100644 --- a/db/tests/query/complex/with_sum_test.go +++ b/tests/integration/query/complex/with_sum_test.go @@ -13,7 +13,7 @@ package complex import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryComplexWithSumOnInlineAndManyToMany(t *testing.T) { diff --git a/db/tests/query/inline_array/simple_test.go b/tests/integration/query/inline_array/simple_test.go similarity index 99% rename from db/tests/query/inline_array/simple_test.go rename to tests/integration/query/inline_array/simple_test.go index 3e1419902b..69482603c9 100644 --- a/db/tests/query/inline_array/simple_test.go +++ b/tests/integration/query/inline_array/simple_test.go @@ -13,7 +13,7 @@ package inline_array import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryInlineArrayWithBooleans(t *testing.T) { diff --git a/db/tests/query/inline_array/utils.go b/tests/integration/query/inline_array/utils.go similarity index 92% rename from db/tests/query/inline_array/utils.go rename to tests/integration/query/inline_array/utils.go index b9298dbd0c..dbee9aceac 100644 --- a/db/tests/query/inline_array/utils.go +++ b/tests/integration/query/inline_array/utils.go @@ -13,7 +13,7 @@ package inline_array import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) var userCollectionGQLSchema = (` diff --git a/db/tests/query/inline_array/with_average_sum_test.go b/tests/integration/query/inline_array/with_average_sum_test.go similarity index 95% rename from db/tests/query/inline_array/with_average_sum_test.go rename to tests/integration/query/inline_array/with_average_sum_test.go index b866ec3fdd..752cdf0392 100644 --- a/db/tests/query/inline_array/with_average_sum_test.go +++ b/tests/integration/query/inline_array/with_average_sum_test.go @@ -13,7 +13,7 @@ package inline_array import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) // Note: this test should follow a different code path to `_avg` on it's own diff --git a/db/tests/query/inline_array/with_average_test.go b/tests/integration/query/inline_array/with_average_test.go similarity index 98% rename from db/tests/query/inline_array/with_average_test.go rename to tests/integration/query/inline_array/with_average_test.go index d55f8d40fe..df918c4f9b 100644 --- a/db/tests/query/inline_array/with_average_test.go +++ b/tests/integration/query/inline_array/with_average_test.go @@ -13,7 +13,7 @@ package inline_array import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryInlineIntegerArrayWithsWithAverageAndNullArray(t *testing.T) { diff --git a/db/tests/query/inline_array/with_count_test.go b/tests/integration/query/inline_array/with_count_test.go similarity index 96% rename from db/tests/query/inline_array/with_count_test.go rename to tests/integration/query/inline_array/with_count_test.go index 9108fe2c15..099ad0c6c8 100644 --- a/db/tests/query/inline_array/with_count_test.go +++ b/tests/integration/query/inline_array/with_count_test.go @@ -13,7 +13,7 @@ package inline_array import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryInlineIntegerArrayWithsWithCountAndNullArray(t *testing.T) { diff --git a/db/tests/query/inline_array/with_sum_test.go b/tests/integration/query/inline_array/with_sum_test.go similarity index 98% rename from db/tests/query/inline_array/with_sum_test.go rename to tests/integration/query/inline_array/with_sum_test.go index 864bbf4ac7..033c789791 100644 --- a/db/tests/query/inline_array/with_sum_test.go +++ b/tests/integration/query/inline_array/with_sum_test.go @@ -13,7 +13,7 @@ package inline_array import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryInlineIntegerArrayWithsWithSumAndNullArray(t *testing.T) { diff --git a/db/tests/query/latest_commits/simple_test.go b/tests/integration/query/latest_commits/simple_test.go similarity index 95% rename from db/tests/query/latest_commits/simple_test.go rename to tests/integration/query/latest_commits/simple_test.go index 9c39013d65..2957068735 100644 --- a/db/tests/query/latest_commits/simple_test.go +++ b/tests/integration/query/latest_commits/simple_test.go @@ -13,7 +13,7 @@ package latest_commits import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryLatestCommits(t *testing.T) { diff --git a/db/tests/query/latest_commits/utils.go b/tests/integration/query/latest_commits/utils.go similarity index 91% rename from db/tests/query/latest_commits/utils.go rename to tests/integration/query/latest_commits/utils.go index 1adb4a249e..039702a315 100644 --- a/db/tests/query/latest_commits/utils.go +++ b/tests/integration/query/latest_commits/utils.go @@ -13,7 +13,7 @@ package latest_commits import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) var userCollectionGQLSchema = (` diff --git a/db/tests/query/one_to_many/simple_test.go b/tests/integration/query/one_to_many/simple_test.go similarity index 97% rename from db/tests/query/one_to_many/simple_test.go rename to tests/integration/query/one_to_many/simple_test.go index c2a343950f..f8a7d98c03 100644 --- a/db/tests/query/one_to_many/simple_test.go +++ b/tests/integration/query/one_to_many/simple_test.go @@ -13,7 +13,7 @@ package one_to_many import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryOneToMany(t *testing.T) { diff --git a/db/tests/query/one_to_many/utils.go b/tests/integration/query/one_to_many/utils.go similarity index 92% rename from db/tests/query/one_to_many/utils.go rename to tests/integration/query/one_to_many/utils.go index 0ced538870..95bd629505 100644 --- a/db/tests/query/one_to_many/utils.go +++ b/tests/integration/query/one_to_many/utils.go @@ -13,7 +13,7 @@ package one_to_many import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) var bookAuthorGQLSchema = (` diff --git a/db/tests/query/one_to_many/with_count_limit_offset_test.go b/tests/integration/query/one_to_many/with_count_limit_offset_test.go similarity index 97% rename from db/tests/query/one_to_many/with_count_limit_offset_test.go rename to tests/integration/query/one_to_many/with_count_limit_offset_test.go index 320089dd10..51b8724def 100644 --- a/db/tests/query/one_to_many/with_count_limit_offset_test.go +++ b/tests/integration/query/one_to_many/with_count_limit_offset_test.go @@ -13,7 +13,7 @@ package one_to_many import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryOneToManyWithCountAndLimitAndOffset(t *testing.T) { diff --git a/db/tests/query/one_to_many/with_count_limit_test.go b/tests/integration/query/one_to_many/with_count_limit_test.go similarity index 96% rename from db/tests/query/one_to_many/with_count_limit_test.go rename to tests/integration/query/one_to_many/with_count_limit_test.go index 4b9896da30..d26bdb58f8 100644 --- a/db/tests/query/one_to_many/with_count_limit_test.go +++ b/tests/integration/query/one_to_many/with_count_limit_test.go @@ -13,7 +13,7 @@ package one_to_many import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryOneToManyWithCountAndLimit(t *testing.T) { diff --git a/db/tests/query/one_to_many/with_count_test.go b/tests/integration/query/one_to_many/with_count_test.go similarity index 97% rename from db/tests/query/one_to_many/with_count_test.go rename to tests/integration/query/one_to_many/with_count_test.go index d2b81ea2e9..bf7bdddf20 100644 --- a/db/tests/query/one_to_many/with_count_test.go +++ b/tests/integration/query/one_to_many/with_count_test.go @@ -13,7 +13,7 @@ package one_to_many import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryOneToManyWithCount(t *testing.T) { diff --git a/db/tests/query/one_to_many/with_filter_test.go b/tests/integration/query/one_to_many/with_filter_test.go similarity index 98% rename from db/tests/query/one_to_many/with_filter_test.go rename to tests/integration/query/one_to_many/with_filter_test.go index ed190812cd..7266568672 100644 --- a/db/tests/query/one_to_many/with_filter_test.go +++ b/tests/integration/query/one_to_many/with_filter_test.go @@ -13,7 +13,7 @@ package one_to_many import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryOneToManyWithNumericGreaterThanFilterOnParent(t *testing.T) { diff --git a/db/tests/query/one_to_many/with_group_filter_test.go b/tests/integration/query/one_to_many/with_group_filter_test.go similarity index 99% rename from db/tests/query/one_to_many/with_group_filter_test.go rename to tests/integration/query/one_to_many/with_group_filter_test.go index 1b67fe7c10..634644d853 100644 --- a/db/tests/query/one_to_many/with_group_filter_test.go +++ b/tests/integration/query/one_to_many/with_group_filter_test.go @@ -13,7 +13,7 @@ package one_to_many import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryOneToManyWithParentJoinGroupNumberAndNumberFilterOnJoin(t *testing.T) { diff --git a/db/tests/query/one_to_many/with_group_test.go b/tests/integration/query/one_to_many/with_group_test.go similarity index 98% rename from db/tests/query/one_to_many/with_group_test.go rename to tests/integration/query/one_to_many/with_group_test.go index 094f4afdba..513dec1d11 100644 --- a/db/tests/query/one_to_many/with_group_test.go +++ b/tests/integration/query/one_to_many/with_group_test.go @@ -13,7 +13,7 @@ package one_to_many import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryOneToManyWithInnerJoinGroupNumber(t *testing.T) { diff --git a/db/tests/query/one_to_many/with_same_field_name_test.go b/tests/integration/query/one_to_many/with_same_field_name_test.go similarity index 97% rename from db/tests/query/one_to_many/with_same_field_name_test.go rename to tests/integration/query/one_to_many/with_same_field_name_test.go index c659b9b69b..2a7340e576 100644 --- a/db/tests/query/one_to_many/with_same_field_name_test.go +++ b/tests/integration/query/one_to_many/with_same_field_name_test.go @@ -13,7 +13,7 @@ package one_to_many import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) var sameFieldNameGQLSchema = (` diff --git a/db/tests/query/one_to_many/with_sort_filter_limit_test.go b/tests/integration/query/one_to_many/with_sort_filter_limit_test.go similarity index 96% rename from db/tests/query/one_to_many/with_sort_filter_limit_test.go rename to tests/integration/query/one_to_many/with_sort_filter_limit_test.go index 6fc288ec2d..004f654d79 100644 --- a/db/tests/query/one_to_many/with_sort_filter_limit_test.go +++ b/tests/integration/query/one_to_many/with_sort_filter_limit_test.go @@ -13,7 +13,7 @@ package one_to_many import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryOneToManyWithNumericGreaterThanFilterOnParentAndNumericSortAscendingAndLimitOnChild( diff --git a/db/tests/query/one_to_many/with_sort_filter_test.go b/tests/integration/query/one_to_many/with_sort_filter_test.go similarity index 98% rename from db/tests/query/one_to_many/with_sort_filter_test.go rename to tests/integration/query/one_to_many/with_sort_filter_test.go index fd7f9d1005..6e76fd799e 100644 --- a/db/tests/query/one_to_many/with_sort_filter_test.go +++ b/tests/integration/query/one_to_many/with_sort_filter_test.go @@ -13,7 +13,7 @@ package one_to_many import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryOneToManyWithNumericGreaterThanFilterOnParentAndNumericSortAscendingOnChild( diff --git a/db/tests/query/one_to_many_multiple/utils.go b/tests/integration/query/one_to_many_multiple/utils.go similarity index 92% rename from db/tests/query/one_to_many_multiple/utils.go rename to tests/integration/query/one_to_many_multiple/utils.go index fb92d00241..c2b142de50 100644 --- a/db/tests/query/one_to_many_multiple/utils.go +++ b/tests/integration/query/one_to_many_multiple/utils.go @@ -13,7 +13,7 @@ package one_to_many_multiple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) var bookAuthorGQLSchema = (` diff --git a/db/tests/query/one_to_many_multiple/with_count_test.go b/tests/integration/query/one_to_many_multiple/with_count_test.go similarity index 97% rename from db/tests/query/one_to_many_multiple/with_count_test.go rename to tests/integration/query/one_to_many_multiple/with_count_test.go index dd89b8e2c6..be3bbd7df3 100644 --- a/db/tests/query/one_to_many_multiple/with_count_test.go +++ b/tests/integration/query/one_to_many_multiple/with_count_test.go @@ -13,7 +13,7 @@ package one_to_many_multiple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryOneToManyMultipleWithCount(t *testing.T) { diff --git a/db/tests/query/one_to_one/simple_test.go b/tests/integration/query/one_to_one/simple_test.go similarity index 97% rename from db/tests/query/one_to_one/simple_test.go rename to tests/integration/query/one_to_one/simple_test.go index a40f355adc..acc0254332 100644 --- a/db/tests/query/one_to_one/simple_test.go +++ b/tests/integration/query/one_to_one/simple_test.go @@ -13,7 +13,7 @@ package one_to_one import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryOneToOne(t *testing.T) { diff --git a/db/tests/query/one_to_one/utils.go b/tests/integration/query/one_to_one/utils.go similarity index 92% rename from db/tests/query/one_to_one/utils.go rename to tests/integration/query/one_to_one/utils.go index b76dc6c2c7..7b082fd9fd 100644 --- a/db/tests/query/one_to_one/utils.go +++ b/tests/integration/query/one_to_one/utils.go @@ -13,7 +13,7 @@ package one_to_one import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) var bookAuthorGQLSchema = (` diff --git a/db/tests/query/one_to_one/with_filter_test.go b/tests/integration/query/one_to_one/with_filter_test.go similarity index 98% rename from db/tests/query/one_to_one/with_filter_test.go rename to tests/integration/query/one_to_one/with_filter_test.go index 9935e1395b..f1858e6f5a 100644 --- a/db/tests/query/one_to_one/with_filter_test.go +++ b/tests/integration/query/one_to_one/with_filter_test.go @@ -13,7 +13,7 @@ package one_to_one import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryOneToOneWithNumericFilterOnParent(t *testing.T) { diff --git a/db/tests/query/one_to_one/with_sort_test.go b/tests/integration/query/one_to_one/with_sort_test.go similarity index 96% rename from db/tests/query/one_to_one/with_sort_test.go rename to tests/integration/query/one_to_one/with_sort_test.go index 4984897a66..cbab20ee45 100644 --- a/db/tests/query/one_to_one/with_sort_test.go +++ b/tests/integration/query/one_to_one/with_sort_test.go @@ -13,7 +13,7 @@ package one_to_one import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryOneToOneWithChildBooleanSortDescending(t *testing.T) { diff --git a/db/tests/query/one_to_two_many/simple_test.go b/tests/integration/query/one_to_two_many/simple_test.go similarity index 99% rename from db/tests/query/one_to_two_many/simple_test.go rename to tests/integration/query/one_to_two_many/simple_test.go index 7dc1344ce2..90d5673d70 100644 --- a/db/tests/query/one_to_two_many/simple_test.go +++ b/tests/integration/query/one_to_two_many/simple_test.go @@ -13,7 +13,7 @@ package one_to_two_many import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryOneToTwoManyWithNilUnnamedRelationship(t *testing.T) { diff --git a/db/tests/query/one_to_two_many/utils.go b/tests/integration/query/one_to_two_many/utils.go similarity index 94% rename from db/tests/query/one_to_two_many/utils.go rename to tests/integration/query/one_to_two_many/utils.go index b88b39e111..3ddb809721 100644 --- a/db/tests/query/one_to_two_many/utils.go +++ b/tests/integration/query/one_to_two_many/utils.go @@ -13,7 +13,7 @@ package one_to_two_many import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) var bookAuthorGQLSchema = (` diff --git a/db/tests/query/one_to_two_many/with_sort_test.go b/tests/integration/query/one_to_two_many/with_sort_test.go similarity index 97% rename from db/tests/query/one_to_two_many/with_sort_test.go rename to tests/integration/query/one_to_two_many/with_sort_test.go index e148ff0c47..2749ffce64 100644 --- a/db/tests/query/one_to_two_many/with_sort_test.go +++ b/tests/integration/query/one_to_two_many/with_sort_test.go @@ -13,7 +13,7 @@ package one_to_two_many import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQueryOneToTwoManyWithSort(t *testing.T) { diff --git a/db/tests/query/simple/simple_test.go b/tests/integration/query/simple/simple_test.go similarity index 96% rename from db/tests/query/simple/simple_test.go rename to tests/integration/query/simple/simple_test.go index 16ba7ce8d2..009d3890a2 100644 --- a/db/tests/query/simple/simple_test.go +++ b/tests/integration/query/simple/simple_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimple(t *testing.T) { diff --git a/db/tests/query/simple/utils.go b/tests/integration/query/simple/utils.go similarity index 91% rename from db/tests/query/simple/utils.go rename to tests/integration/query/simple/utils.go index 93faafbf57..69382c8eaa 100644 --- a/db/tests/query/simple/utils.go +++ b/tests/integration/query/simple/utils.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) var userCollectionGQLSchema = (` diff --git a/db/tests/query/simple/with_filter_test.go b/tests/integration/query/simple/with_filter_test.go similarity index 99% rename from db/tests/query/simple/with_filter_test.go rename to tests/integration/query/simple/with_filter_test.go index 71375d130a..1bbb09be57 100644 --- a/db/tests/query/simple/with_filter_test.go +++ b/tests/integration/query/simple/with_filter_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithDocKeyFilter(t *testing.T) { diff --git a/db/tests/query/simple/with_group_average_count_test.go b/tests/integration/query/simple/with_group_average_count_test.go similarity index 96% rename from db/tests/query/simple/with_group_average_count_test.go rename to tests/integration/query/simple/with_group_average_count_test.go index 1bea427d02..f86e65732d 100644 --- a/db/tests/query/simple/with_group_average_count_test.go +++ b/tests/integration/query/simple/with_group_average_count_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) // Note: this test should follow a different code path to `_avg` on it's own diff --git a/db/tests/query/simple/with_group_average_filter_test.go b/tests/integration/query/simple/with_group_average_filter_test.go similarity index 98% rename from db/tests/query/simple/with_group_average_filter_test.go rename to tests/integration/query/simple/with_group_average_filter_test.go index 4e2d6ab462..62b3d2de31 100644 --- a/db/tests/query/simple/with_group_average_filter_test.go +++ b/tests/integration/query/simple/with_group_average_filter_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildAverageWithFilter(t *testing.T) { diff --git a/db/tests/query/simple/with_group_average_sum_test.go b/tests/integration/query/simple/with_group_average_sum_test.go similarity index 98% rename from db/tests/query/simple/with_group_average_sum_test.go rename to tests/integration/query/simple/with_group_average_sum_test.go index 01d3c1c8c1..ab56db058a 100644 --- a/db/tests/query/simple/with_group_average_sum_test.go +++ b/tests/integration/query/simple/with_group_average_sum_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndSumOfCountOfInt(t *testing.T) { diff --git a/db/tests/query/simple/with_group_average_test.go b/tests/integration/query/simple/with_group_average_test.go similarity index 99% rename from db/tests/query/simple/with_group_average_test.go rename to tests/integration/query/simple/with_group_average_test.go index f69c3192ce..faf4c398b6 100644 --- a/db/tests/query/simple/with_group_average_test.go +++ b/tests/integration/query/simple/with_group_average_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndAverageOfUndefined(t *testing.T) { diff --git a/db/tests/query/simple/with_group_count_filter_test.go b/tests/integration/query/simple/with_group_count_filter_test.go similarity index 98% rename from db/tests/query/simple/with_group_count_filter_test.go rename to tests/integration/query/simple/with_group_count_filter_test.go index 47e2fb6462..45a43d4338 100644 --- a/db/tests/query/simple/with_group_count_filter_test.go +++ b/tests/integration/query/simple/with_group_count_filter_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithGroupByNumberWithoutRenderedGroupAndChildCountWithFilter(t *testing.T) { diff --git a/db/tests/query/simple/with_group_count_sum_test.go b/tests/integration/query/simple/with_group_count_sum_test.go similarity index 96% rename from db/tests/query/simple/with_group_count_sum_test.go rename to tests/integration/query/simple/with_group_count_sum_test.go index fb6fa0cedf..c8dc2bd271 100644 --- a/db/tests/query/simple/with_group_count_sum_test.go +++ b/tests/integration/query/simple/with_group_count_sum_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndSumOfCount(t *testing.T) { diff --git a/db/tests/query/simple/with_group_count_test.go b/tests/integration/query/simple/with_group_count_test.go similarity index 98% rename from db/tests/query/simple/with_group_count_test.go rename to tests/integration/query/simple/with_group_count_test.go index ebfa49e4af..0c868d92b6 100644 --- a/db/tests/query/simple/with_group_count_test.go +++ b/tests/integration/query/simple/with_group_count_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithGroupByNumberWithoutRenderedGroupAndChildCount(t *testing.T) { diff --git a/db/tests/query/simple/with_group_filter_test.go b/tests/integration/query/simple/with_group_filter_test.go similarity index 98% rename from db/tests/query/simple/with_group_filter_test.go rename to tests/integration/query/simple/with_group_filter_test.go index 3a1f6e8348..6f53215731 100644 --- a/db/tests/query/simple/with_group_filter_test.go +++ b/tests/integration/query/simple/with_group_filter_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithGroupByStringWithGroupNumberFilter(t *testing.T) { diff --git a/db/tests/query/simple/with_group_limit_offset_test.go b/tests/integration/query/simple/with_group_limit_offset_test.go similarity index 96% rename from db/tests/query/simple/with_group_limit_offset_test.go rename to tests/integration/query/simple/with_group_limit_offset_test.go index ea3adc66a2..5db77003f5 100644 --- a/db/tests/query/simple/with_group_limit_offset_test.go +++ b/tests/integration/query/simple/with_group_limit_offset_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithGroupByNumberWithGroupLimitAndOffset(t *testing.T) { diff --git a/db/tests/query/simple/with_group_limit_test.go b/tests/integration/query/simple/with_group_limit_test.go similarity index 98% rename from db/tests/query/simple/with_group_limit_test.go rename to tests/integration/query/simple/with_group_limit_test.go index 5a59f95675..f56e43736d 100644 --- a/db/tests/query/simple/with_group_limit_test.go +++ b/tests/integration/query/simple/with_group_limit_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithGroupByNumberWithGroupLimit(t *testing.T) { diff --git a/db/tests/query/simple/with_group_sort_test.go b/tests/integration/query/simple/with_group_sort_test.go similarity index 99% rename from db/tests/query/simple/with_group_sort_test.go rename to tests/integration/query/simple/with_group_sort_test.go index 9d5f8ca5c1..a99196ea14 100644 --- a/db/tests/query/simple/with_group_sort_test.go +++ b/tests/integration/query/simple/with_group_sort_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithGroupByStringWithGroupNumberWithGroupSort(t *testing.T) { diff --git a/db/tests/query/simple/with_group_sum_filter_test.go b/tests/integration/query/simple/with_group_sum_filter_test.go similarity index 98% rename from db/tests/query/simple/with_group_sum_filter_test.go rename to tests/integration/query/simple/with_group_sum_filter_test.go index 4e47812dc7..9cbcab7034 100644 --- a/db/tests/query/simple/with_group_sum_filter_test.go +++ b/tests/integration/query/simple/with_group_sum_filter_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithGroupByNumberWithoutRenderedGroupAndChildSumWithFilter(t *testing.T) { diff --git a/db/tests/query/simple/with_group_sum_test.go b/tests/integration/query/simple/with_group_sum_test.go similarity index 99% rename from db/tests/query/simple/with_group_sum_test.go rename to tests/integration/query/simple/with_group_sum_test.go index da8e028484..867db72fa8 100644 --- a/db/tests/query/simple/with_group_sum_test.go +++ b/tests/integration/query/simple/with_group_sum_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndSumOfUndefined(t *testing.T) { diff --git a/db/tests/query/simple/with_group_test.go b/tests/integration/query/simple/with_group_test.go similarity index 99% rename from db/tests/query/simple/with_group_test.go rename to tests/integration/query/simple/with_group_test.go index 93aa55b5a0..e183566ccd 100644 --- a/db/tests/query/simple/with_group_test.go +++ b/tests/integration/query/simple/with_group_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithGroupByNumber(t *testing.T) { diff --git a/db/tests/query/simple/with_limit_offset_test.go b/tests/integration/query/simple/with_limit_offset_test.go similarity index 97% rename from db/tests/query/simple/with_limit_offset_test.go rename to tests/integration/query/simple/with_limit_offset_test.go index b5286d799a..a095d65dbd 100644 --- a/db/tests/query/simple/with_limit_offset_test.go +++ b/tests/integration/query/simple/with_limit_offset_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithLimit(t *testing.T) { diff --git a/db/tests/query/simple/with_sort_filter_test.go b/tests/integration/query/simple/with_sort_filter_test.go similarity index 94% rename from db/tests/query/simple/with_sort_filter_test.go rename to tests/integration/query/simple/with_sort_filter_test.go index e7362bc79b..914f4d96a1 100644 --- a/db/tests/query/simple/with_sort_filter_test.go +++ b/tests/integration/query/simple/with_sort_filter_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithNumericGreaterThanFilterAndNumericSortDescending(t *testing.T) { diff --git a/db/tests/query/simple/with_sort_test.go b/tests/integration/query/simple/with_sort_test.go similarity index 97% rename from db/tests/query/simple/with_sort_test.go rename to tests/integration/query/simple/with_sort_test.go index f0fcaecf44..abff13aed2 100644 --- a/db/tests/query/simple/with_sort_test.go +++ b/tests/integration/query/simple/with_sort_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithNumericSortAscending(t *testing.T) { diff --git a/db/tests/query/simple/with_version_test.go b/tests/integration/query/simple/with_version_test.go similarity index 95% rename from db/tests/query/simple/with_version_test.go rename to tests/integration/query/simple/with_version_test.go index f604d9ed0c..0ed4810a46 100644 --- a/db/tests/query/simple/with_version_test.go +++ b/tests/integration/query/simple/with_version_test.go @@ -13,7 +13,7 @@ package simple import ( "testing" - testUtils "github.com/sourcenetwork/defradb/db/tests" + testUtils "github.com/sourcenetwork/defradb/tests/integration" ) func TestQuerySimpleWithEmbeddedLatestCommit(t *testing.T) { diff --git a/db/tests/utils.go b/tests/integration/utils.go similarity index 99% rename from db/tests/utils.go rename to tests/integration/utils.go index a2abe78f04..1cb75f2ca4 100644 --- a/db/tests/utils.go +++ b/tests/integration/utils.go @@ -45,7 +45,7 @@ const ( ) var ( - log = logging.MustNewLogger("defra.db.tests") + log = logging.MustNewLogger("defra.tests.integration") badgerInMemory bool badgerFile bool mapStore bool @@ -523,9 +523,9 @@ func setupDatabaseUsingTargetBranch( panic(err) } - targetTestPackage := detectDbChangesCodeDir + "/db/tests/" + strings.Split( + targetTestPackage := detectDbChangesCodeDir + "/tests/integration/" + strings.Split( currentTestPackage, - "/db/tests/", + "/tests/integration/", )[1] // If we are checking for database changes, and we are not seting up the database, diff --git a/tools/configs/golangci.yaml b/tools/configs/golangci.yaml index 275cdc2428..dd851147cc 100644 --- a/tools/configs/golangci.yaml +++ b/tools/configs/golangci.yaml @@ -55,7 +55,6 @@ run: # If false (default) - golangci-lint acquires file lock on start. allow-parallel-runners: false - #=====================================================================================[ Output Configuration Options ] output: # colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions @@ -76,7 +75,6 @@ output: # sorts results by: filepath, line and column sort-results: true - #===========================================================================[ Linter Specific Severity Configuration ] severity: default-severity: error @@ -94,7 +92,6 @@ severity: # - dupl # severity: info - #==================================================================================================[ Enabled Linters ] linters: fast: false @@ -142,8 +139,7 @@ linters: # - wrapcheck # - wsl # - golint # Definitely need this to never have an undocumented exported function, - # once the deadcode issue is resolved. - + # once the deadcode issue is resolved. #====================================================[ Tweaks To Fix Issues or Exclude linter(s) on Select Locations ] issues: @@ -152,18 +148,18 @@ issues: # it can be disabled by `exclude-use-default: false`. To list all # excluded by default patterns execute `golangci-lint run --help` exclude: - # - abcdef + # - abcdef # Excluding configuration per-path, per-linter, per-text and per-source exclude-rules: # Exclude some linters from running on tests files. - - path: '_test.go$' + - path: "_test.go$" linters: - errcheck - lll # Exclude running header check in these paths - - path: '(net|datastore/badger/v3/compat_logger.go|datastore/badger/v3/datastore.go)' + - path: "(net|datastore/badger/v3/compat_logger.go|datastore/badger/v3/datastore.go)" linters: - goheader @@ -197,11 +193,8 @@ issues: # Don't auto-fix found issues by default (even if it's supported by the linter). fix: false - #==================================================================[ All Settings Of Specific Linters We Have Enabled] linters-settings: - - errcheck: # report about not checking of errors in type assertions: `a := b.(MyStruct)`; # default is false: such cases aren't reported by default. @@ -218,7 +211,6 @@ linters-settings: # - io.Copy(*bytes.Buffer) # - io.Copy(os.Stdout) - forbidigo: # Forbid the following identifiers (identifiers are written using regexp): forbid: @@ -226,17 +218,15 @@ linters-settings: # Exclude godoc examples from forbidigo checks. exclude_godoc_examples: false - gofmt: simplify: true - goheader: values: const: # define here const type values in format k:v, for example: - BSL: 'Business Source License' - APL: 'Apache License, Version 2.0' + BSL: "Business Source License" + APL: "Apache License, Version 2.0" regexp: # define here regexp type values, for example @@ -256,17 +246,15 @@ linters-settings: template-path: # also as alternative of directive 'template' you may put the path to file with the template source - gosimple: # Select the Go version to target. - go: '1.17' + go: "1.17" # https://staticcheck.io/docs/options#checks - checks: [ "all", "-S1038" ] + checks: ["all", "-S1038"] # Turn on all except (these are disabled): # - S1038 - Unnecessarily complex way of printing formatted string. Which said # instead of using fmt.Print(fmt.Sprintf(...)), one can use fmt.Printf(...). - govet: # report about shadowed variables check-shadowing: false @@ -292,7 +280,6 @@ linters-settings: disable-all: false - lll: # max line length, lines longer will be reported. # '\t' is counted as 1 character. @@ -300,7 +287,6 @@ linters-settings: # tab width in spaces. tab-width: 1 - revive: # see https://github.com/mgechev/revive#available-rules for details. ignore-generated-header: true @@ -309,29 +295,24 @@ linters-settings: - name: superfluous-else severity: error - staticcheck: # Select the Go version to target. - go: '1.17' + go: "1.17" # https://staticcheck.io/docs/options#checks - checks: [ "all" ] - + checks: ["all"] unused: # Select the Go version to target. - go: '1.17' - + go: "1.17" # The custom section can be used to define linter plugins to be loaded at runtime. # See README doc for more info. custom: # Each custom linter should have a unique name. - example: + example: # The path to the plugin *.so. Can be absolute or local. Required for each custom linter # path: /path/to/example.so # The description of the linter. Optional, just for documentation purposes. # description: This is an example usage of a plugin linter. # Intended to point to the repo location of the linter. Optional, just for documentation purposes. # original-url: github.com/golangci/example-linter - -