Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Locating integration tests in top-level folder #453

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Source Network's codecov configuration file.

github_checks:
annotations: true
annotations: true

codecov:
require_ci_to_pass: yes
Expand Down Expand Up @@ -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"
- "testing"
- "**/*_test.go"
10 changes: 9 additions & 1 deletion .github/workflows/lint-then-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,21 @@ jobs:
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>/,/<\/body>/p" > comparison.html &&
./tools/scripts/pretty-benchstat-html.sh comparison.html > pretty-comparison.md

Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ build/defradb*
cover.out
coverage-full.txt
coverage-quick.txt
bench/*.log
bench/*.svg
.vscode
testing/bench/*.log
testing/bench/*.svg
.vscode
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ test\:clean: clean\:test test

.PHONY: test\:bench
test\:bench:
make -C ./bench/ bench
make -C ./testing/bench/ bench

.PHONY: test\:bench-short
test\:bench-short:
make -C ./bench/ bench:short
make -C ./testing/bench/ bench:short

# This also takes integration tests into account.
.PHONY: test\:coverage-full
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions bench/bench_util.go → testing/bench/bench_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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/testing/bench/fixtures"
testutils "github.com/sourcenetwork/defradb/testing/db"
)

const (
Expand All @@ -36,7 +36,7 @@ const (

var (
storage string = "memory"
log = logging.MustNewLogger("defra.bench")
log = logging.MustNewLogger("defra.testing.bench")
)

func init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"context"
"testing"

"github.com/sourcenetwork/defradb/bench/fixtures"
"github.com/sourcenetwork/defradb/testing/bench/fixtures"
)

func Benchmark_Collection_UserSimple_CreateMany_Sync_0_10(b *testing.B) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"context"
"testing"

"github.com/sourcenetwork/defradb/bench/fixtures"
"github.com/sourcenetwork/defradb/testing/bench/fixtures"
)

func Benchmark_Collection_UserSimple_Create_Sync_0_1(b *testing.B) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"context"
"testing"

"github.com/sourcenetwork/defradb/bench/fixtures"
"github.com/sourcenetwork/defradb/testing/bench/fixtures"
)

func Benchmark_Collection_UserSimple_Read_Sync_1_1(b *testing.B) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/testing/bench"
"github.com/sourcenetwork/defradb/testing/bench/fixtures"
)

const (
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"context"
"testing"

"github.com/sourcenetwork/defradb/bench/fixtures"
"github.com/sourcenetwork/defradb/testing/bench/fixtures"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/testing/bench"
"github.com/sourcenetwork/defradb/testing/bench/fixtures"
)

func runQueryParserBench(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"context"
"testing"

"github.com/sourcenetwork/defradb/bench/fixtures"
"github.com/sourcenetwork/defradb/testing/bench/fixtures"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/testing/bench"
"github.com/sourcenetwork/defradb/testing/bench/fixtures"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"context"
"testing"

"github.com/sourcenetwork/defradb/bench/fixtures"
"github.com/sourcenetwork/defradb/testing/bench/fixtures"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"context"
"testing"

"github.com/sourcenetwork/defradb/bench/fixtures"
"github.com/sourcenetwork/defradb/testing/bench/fixtures"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"context"
"testing"

"github.com/sourcenetwork/defradb/bench/fixtures"
"github.com/sourcenetwork/defradb/testing/bench/fixtures"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"context"
"testing"

"github.com/sourcenetwork/defradb/bench/fixtures"
"github.com/sourcenetwork/defradb/testing/bench/fixtures"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"context"
"testing"

"github.com/sourcenetwork/defradb/bench/fixtures"
"github.com/sourcenetwork/defradb/testing/bench/fixtures"
)

var (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion bench/storage/utils.go → testing/bench/storage/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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/testing/bench"
)

func runStorageBenchGet(
Expand Down
10 changes: 5 additions & 5 deletions db/tests/README.md → testing/db/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
- We want to keep the mutation and query tests separate, here is what the folder
structure looks like currently:
```
db/tests
testing/db
├── mutation/
└── query/
```

- Every immediate directory under `db/tests/mutation` and `db/tests/query` should ONLY contain
- Every immediate directory under `testing/db/mutation` and `testing/db/query` should ONLY contain
a single schema. For example:
`db/tests/query/simple` and `db/tests/query/complex` have different schemas.
`testing/db/query/simple` and `testing/db/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
- `testing/db/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
- `testing/db/mutation/simple/mix`: contains test that use
the `simple` schema to test combination of mutations.
Original file line number Diff line number Diff line change
Expand Up @@ -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/testing/db"
inlineArray "github.com/sourcenetwork/defradb/testing/db/mutation/inline_array"
)

func TestMutationInlineArrayUpdateWithBooleans(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package inline_array
import (
"testing"

testUtils "github.com/sourcenetwork/defradb/db/tests"
testUtils "github.com/sourcenetwork/defradb/testing/db"
)

var userCollectionGQLSchema = (`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/testing/db"
relationTests "github.com/sourcenetwork/defradb/testing/db/mutation/relation"
)

func TestRelationalDeletionOfADocumentUsingSingleKey_Success(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package relation
import (
"testing"

testUtils "github.com/sourcenetwork/defradb/db/tests"
testUtils "github.com/sourcenetwork/defradb/testing/db"
)

var bookAuthorPublisherGQLSchema = (`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/testing/db"
simpleTests "github.com/sourcenetwork/defradb/testing/db/mutation/simple"
)

func TestMutationCreateSimple(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/testing/db"
simpleTests "github.com/sourcenetwork/defradb/testing/db/mutation/simple"
)

func TestDeletionOfMultipleDocumentUsingMultipleKeys_Success(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/testing/db"
simpleTests "github.com/sourcenetwork/defradb/testing/db/mutation/simple"
)

func TestDeletionOfADocumentUsingSingleKey_Success(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/testing/db"
simpleTests "github.com/sourcenetwork/defradb/testing/db/mutation/simple"
)

func TestDeletionOfDocumentsWithFilter_Success(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/testing/db"
simpleTests "github.com/sourcenetwork/defradb/testing/db/mutation/simple"
)

func TestMutationWithTxnDeletesUserGivenSameTransaction(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/testing/db"
simpleTests "github.com/sourcenetwork/defradb/testing/db/mutation/simple"
)

func TestSimpleMutationUpdateWithBooleanFilter(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package simple
import (
"testing"

testUtils "github.com/sourcenetwork/defradb/db/tests"
testUtils "github.com/sourcenetwork/defradb/testing/db"
)

var userSchema = (`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package all_commits
import (
"testing"

testUtils "github.com/sourcenetwork/defradb/db/tests"
testUtils "github.com/sourcenetwork/defradb/testing/db"
)

func TestQueryAllCommitsSingleDAG(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package all_commits
import (
"testing"

testUtils "github.com/sourcenetwork/defradb/db/tests"
testUtils "github.com/sourcenetwork/defradb/testing/db"
)

var userCollectionGQLSchema = (`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package all_commits
import (
"testing"

testUtils "github.com/sourcenetwork/defradb/db/tests"
testUtils "github.com/sourcenetwork/defradb/testing/db"
)

func TestQueryAllCommitsSingleDAGWithLinkCount(t *testing.T) {
Expand Down
Loading