Add test coverage for []T slice support and predicate= tag#9
Merged
matthewmcneely merged 6 commits intomatthewmcneely:mainfrom Feb 28, 2026
Merged
Conversation
…te= e2e tests - Add replace directive for github.com/dolan-in/dgman/v2 => ../dgman to pull in predicate= fixes from the dgman fork. - Add slice_test.go with tests proving []T value-type slices work: - TestValueTypeSliceInsertAndQuery: insert/get with []Genre - TestPointerTypeSliceInsertAndQuery: baseline with []*Genre - TestValueTypeSliceParity: confirms []T and []*T produce equivalent results - TestValueTypeSliceUpdate: update with additional []Genre elements - TestValueTypeSliceEmpty: nil/empty slice handling - Add predicate_test.go with e2e tests for predicate= tag support: - TestPredicateInsertAndGet: round-trip with predicate= fields - TestPredicateUpdate: update with predicate= fields - TestPredicateUpsert: upsert with predicate= (skipped, depends on dgman read fix) - TestPredicateQuery: filter queries using predicate names
Add unique to PredicateFilm.Title dgraph tag (required for dgman upsert deduplication) and remove t.Skip now that the dgman fork fixes both read and write paths for predicate= fields.
The replace github.com/dolan-in/dgman/v2 => ../dgman directive was needed for local development with the forked dgman. Remove it for the upstream PR since the upstream repo should use the published dgman module.
Test that forward edges (predicate=written_by) and reverse edges (predicate=~written_by) work correctly together through Insert, Get, and Query operations. This covers the pattern used by modusGraphGen for entities like Film/Genre where the reverse edge is declared on the parent entity.
Owner
matthewmcneely
left a comment
There was a problem hiding this comment.
@mlwelles When you say "Adds support for explicit value slices in addition to well as pointer slices"... that is not something added in the codepath of modusgraph, only in showing that it's possible by testing, right?
Author
|
Sorry! IIRC, I was on a call and multitasking when I asked Claude to open and write the PR for this. It seemed such a simple one and, otherwise distracted , I didn't check the description to make sure it was correct. |
matthewmcneely
approved these changes
Feb 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds test coverage for existing functionality in modusGraph and dgman:
Value-type slice tests (
slice_test.go) — Verifies that[]T(value-type) slices round-trip correctly and behave the same as[]*T(pointer) slices for entity relationships. This exercises existing dgman behavior where value copies are assigned when populating non-pointer slice fields.predicate=tag e2e tests (predicate_test.go) — Comprehensive end-to-end tests for thedgraph:"predicate=<name>"struct tag, covering filters, upsert, query builder, and forward/reverse edge traversal. These tests confirm that custom predicate names work correctly across all dgman operations, decoupling Go field names and JSON keys from Dgraph predicate names.Reverse edge tests — Validates the
predicate=~<name>pattern for reverse edge traversal with custom predicate names.Dependency
The
predicate_test.gotests depend on bug fixes in dgman forpredicate=tag support, which have been merged:33441ef, taggedv2.2.0)v2.2.0Changes
slice_test.go(new): Value slice round-trip tests for string, int, float, bool slicespredicate_test.go(new): Full CRUD + search + query builder tests withpredicate=custom namesgo.mod/go.sum: Updated dgman tov2.2.0, removed localreplacedirectiveTest plan
slice_test.gopasses against live Dgraphpredicate_test.gopasses against live Dgraphv2.2.0release