Dagger
Search

tests

standalone dagger function so it can be invoked individually during
TDD; All wires them up for parallel execution under
`dagger call all`.

Installation

dagger install github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453

Entrypoint

Return Type
Tests
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
func (m *MyModule) Example() *dagger.Tests  {
	return dag.
			Tests()
}
@function
def example() -> dagger.Tests:
	return (
		dag.tests()
	)
@func()
example(): Tests {
	return dag
		.tests()
}

Types

Tests 🔗

all() 🔗

All runs every dgraph test as a convenience for local dagger call all invocations. CI does NOT call All: each of the two sub-aggregators below (Validation, Cluster) carries its own `directive, so GH Actions schedules each onto its own runner in parallel — running All on top would double-bill the same work.

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
parallelInteger !0No description provided
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 all --parallel integer
func (m *MyModule) Example(ctx context.Context, parallel int)   {
	return dag.
			Tests().
			All(ctx, parallel)
}
@function
async def example(parallel: int) -> None:
	return await (
		dag.tests()
		.all(parallel)
	)
@func()
async example(parallel: number): Promise<void> {
	return dag
		.tests()
		.all(parallel)
}

bindAlphasResolvesFromUserContainerTls() 🔗

BindAlphasResolvesFromUserContainerTls boots a one-way-TLS cluster, binds its Alphas into an alpine container, and proves the Alpha’s HTTPS /health listener is reachable there: wget --ca-certificate (trusting the test CA) succeeds, while the same wget without the CA fails certificate verification.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 bind-alphas-resolves-from-user-container-tls
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Bindalphasresolvesfromusercontainertls(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.bindalphasresolvesfromusercontainertls()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.bindAlphasResolvesFromUserContainerTls()
}

clientAlterSchemaRoundTrip() 🔗

ClientAlterSchemaRoundTrip verifies AlterSchema accepts a non-trivial DQL schema and the cluster reports it on subsequent schema queries.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 client-alter-schema-round-trip
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Clientalterschemaroundtrip(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.clientalterschemaroundtrip()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.clientAlterSchemaRoundTrip()
}

clientMutateThenQueryRoundTrip() 🔗

ClientMutateThenQueryRoundTrip applies a schema, sets a triple with a random value, and verifies the value reads back via Query.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 client-mutate-then-query-round-trip
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Clientmutatethenqueryroundtrip(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.clientmutatethenqueryroundtrip()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.clientMutateThenQueryRoundTrip()
}

clientMutateWithoutCommitDoesNotPersist() 🔗

ClientMutateWithoutCommitDoesNotPersist mutates with commit=false and verifies a subsequent Query does NOT see the value.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 client-mutate-without-commit-does-not-persist
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Clientmutatewithoutcommitdoesnotpersist(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.clientmutatewithoutcommitdoesnotpersist()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.clientMutateWithoutCommitDoesNotPersist()
}

clientQueryWithVarsRoundTrip() 🔗

ClientQueryWithVarsRoundTrip exercises the variable-substitution path of QueryWithVars, which crosses the Dagger boundary as a JSON-encoded map.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 client-query-with-vars-round-trip
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Clientquerywithvarsroundtrip(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.clientquerywithvarsroundtrip()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.clientQueryWithVarsRoundTrip()
}

cluster() 🔗

Cluster runs the topology and client round-trip tests. Each test passes its own name to freshCluster, which folds into Dgraph.Cluster’s session-cache key so concurrent tests boot independent backing services and never share schema or storage.

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
parallelInteger !0No description provided
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 cluster --parallel integer
func (m *MyModule) Example(ctx context.Context, parallel int)   {
	return dag.
			Tests().
			Cluster(ctx, parallel)
}
@function
async def example(parallel: int) -> None:
	return await (
		dag.tests()
		.cluster(parallel)
	)
@func()
async example(parallel: number): Promise<void> {
	return dag
		.tests()
		.cluster(parallel)
}

clusterMtlsRoundTripFromClient() 🔗

ClusterMtlsRoundTripFromClient boots a mutual-TLS cluster and proves a matching mTLS client (presenting a client cert signed by the trusted CA) can AlterSchema + Mutate + Query. One CA both signs the server leaf and anchors the accepted client certs — the simplest symmetric mTLS trust setup.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 cluster-mtls-round-trip-from-client
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Clustermtlsroundtripfromclient(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.clustermtlsroundtripfromclient()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.clusterMtlsRoundTripFromClient()
}

clusterRejectsEvenReplicas() 🔗

ClusterRejectsEvenReplicas verifies that an even replicas value > 1 is rejected — Dgraph’s Raft consensus needs an odd replica count per group (or replicas=1 for no replication). Alphas=2 keeps alphas%replicas==0 so only the odd-replicas rule can trip.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 cluster-rejects-even-replicas
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Clusterrejectsevenreplicas(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.clusterrejectsevenreplicas()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.clusterRejectsEvenReplicas()
}

clusterRejectsInvalidAlphasReplicasRatio() 🔗

ClusterRejectsInvalidAlphasReplicasRatio verifies alphas % replicas != 0 is rejected.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 cluster-rejects-invalid-alphas-replicas-ratio
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Clusterrejectsinvalidalphasreplicasratio(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.clusterrejectsinvalidalphasreplicasratio()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.clusterRejectsInvalidAlphasReplicasRatio()
}

clusterRejectsMultipleZeros() 🔗

ClusterRejectsMultipleZeros verifies zeros != 1 surfaces a descriptive error.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 cluster-rejects-multiple-zeros
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Clusterrejectsmultiplezeros(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.clusterrejectsmultiplezeros()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.clusterRejectsMultipleZeros()
}

clusterRejectsNilSecurity() 🔗

ClusterRejectsNilSecurity verifies that a nil clientListenerSecurity is rejected. The Dagger SDK’s binding panics via assertNotNil before the call leaves the test module; recover and assert the panic mentions the rejected argument.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 cluster-rejects-nil-security
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Clusterrejectsnilsecurity(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.clusterrejectsnilsecurity()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.clusterRejectsNilSecurity()
}

clusterTlsRoundTripFromClient() 🔗

ClusterTlsRoundTripFromClient boots a one-way-TLS cluster and proves a matching TLS client (pinning the server CA) can AlterSchema + Mutate + Query end to end.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 cluster-tls-round-trip-from-client
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Clustertlsroundtripfromclient(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.clustertlsroundtripfromclient()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.clusterTlsRoundTripFromClient()
}

defaultsProduceWorkingSingleNodeCluster() 🔗

DefaultsProduceWorkingSingleNodeCluster boots a 1-Zero, 1-Alpha, replicas=1 cluster (the constructor defaults) and runs a schema alteration against it to prove it’s serving requests.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 defaults-produce-working-single-node-cluster
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Defaultsproduceworkingsinglenodecluster(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.defaultsproduceworkingsinglenodecluster()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.defaultsProduceWorkingSingleNodeCluster()
}

grpcEndpointsShouldNotBeCached() 🔗

GrpcEndpointsShouldNotBeCached verifies that GrpcEndpoints re-executes on every call rather than returning a cached snapshot. We boot the cluster, fetch endpoints (starts services), Stop the cluster (kills services), and call GrpcEndpoints again — the second call must re-start the services. A bare length check can’t distinguish that from cached strings, so we follow the second call with a real AlterSchema against the cluster: if start() didn’t run because GrpcEndpoints returned a cached result, the alphas remain dead and the alter dials a hung port.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 grpc-endpoints-should-not-be-cached
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Grpcendpointsshouldnotbecached(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.grpcendpointsshouldnotbecached()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.grpcEndpointsShouldNotBeCached()
}

httpEndpointsShouldNotBeCached() 🔗

HttpEndpointsShouldNotBeCached: same restart-after-stop check as Grpc but for the HTTP listener. The liveness probe is the same gRPC-based AlterSchema — both endpoint methods share start(), so any restart proves either never-cache directive fired.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 http-endpoints-should-not-be-cached
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Httpendpointsshouldnotbecached(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.httpendpointsshouldnotbecached()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.httpEndpointsShouldNotBeCached()
}

mtlsClusterRejectsTlsOnlyClient() 🔗

MtlsClusterRejectsTlsOnlyClient boots an mTLS cluster and proves a TLS-only client (verifies the server but presents no client cert) fails at the gRPC handshake — the REQUIREANDVERIFY listener demands a client certificate. This goes through the standalone Dgraph.Client, which has no cluster reference and so cannot short-circuit with a mode-mismatch error: the failure must come from the wire.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 mtls-cluster-rejects-tls-only-client
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Mtlsclusterrejectstlsonlyclient(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.mtlsclusterrejectstlsonlyclient()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.mtlsClusterRejectsTlsOnlyClient()
}

multiAlphaShardedTopology() 🔗

MultiAlphaShardedTopology boots a 2-Alpha cluster at replicas=1 (two groups, one Alpha each — sharded, no replication) and verifies the cluster serves a trivial schema alteration. Dgraph’s Raft consensus requires replicas to be odd, so the smallest valid sharded topology is 2 Alphas at replicas=1.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 multi-alpha-sharded-topology
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Multialphashardedtopology(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.multialphashardedtopology()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.multiAlphaShardedTopology()
}

multiAlphaSingleGroupAllReachable() 🔗

MultiAlphaSingleGroupAllReachable boots a 3-Alpha cluster at replicas=3 (single group of three Alphas, fully replicated) and verifies every endpoint serves queries.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 multi-alpha-single-group-all-reachable
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Multialphasinglegroupallreachable(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.multialphasinglegroupallreachable()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.multiAlphaSingleGroupAllReachable()
}

mutateShouldNotBeCached() 🔗

MutateShouldNotBeCached calls Mutate twice with the same payload on the same cluster and verifies each call assigns a fresh UID. If the engine cached the call, both would return identical UID JSON. The payload value is randomised per-run so re-running the suite never reuses a probe name across engine sessions.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 mutate-should-not-be-cached
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Mutateshouldnotbecached(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.mutateshouldnotbecached()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.mutateShouldNotBeCached()
}

remoteClientCanTargetExistingCluster() 🔗

RemoteClientCanTargetExistingCluster builds a cluster locally, then constructs a top-level Dgraph.Client (not Cluster.Client) against the cluster’s endpoints — proving the constructor works against any reachable address list.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 remote-client-can-target-existing-cluster
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Remoteclientcantargetexistingcluster(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.remoteclientcantargetexistingcluster()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.remoteClientCanTargetExistingCluster()
}

security() 🔗

Security runs the TLS / mTLS round-trip, mode-coupling, and container- binding tests. Each mints its own per-test CA and cert material and (for the round-trip / bind tests) boots an independent backing cluster keyed by a unique name, so the jobs are safe to fan out.

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
parallelInteger !0No description provided
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 security --parallel integer
func (m *MyModule) Example(ctx context.Context, parallel int)   {
	return dag.
			Tests().
			Security(ctx, parallel)
}
@function
async def example(parallel: int) -> None:
	return await (
		dag.tests()
		.security(parallel)
	)
@func()
async example(parallel: number): Promise<void> {
	return dag
		.tests()
		.security(parallel)
}

tlsClusterRejectsPlaintextClient() 🔗

TlsClusterRejectsPlaintextClient verifies the mode-coupling check: asking a TLS cluster for a plaintext client returns an error naming both modes, before any wire activity. The requireMode guard fires ahead of GrpcEndpoints, so no cluster boots.

Return Type
Void !
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 tls-cluster-rejects-plaintext-client
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Tests().
			Tlsclusterrejectsplaintextclient(ctx)
}
@function
async def example() -> None:
	return await (
		dag.tests()
		.tlsclusterrejectsplaintextclient()
	)
@func()
async example(): Promise<void> {
	return dag
		.tests()
		.tlsClusterRejectsPlaintextClient()
}

validation() 🔗

Validation runs the pure-validation tests (ClusterRejects*) plus the cache-directive tests (*ShouldNotBeCached) that explicitly Stop their cluster after use. These don’t share session-cached cluster state, so they’re safe to fan out unbounded.

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
parallelInteger !0No description provided
Example
dagger -m github.com/z5labs/devex/daggerverse/dgraph/tests@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
 validation --parallel integer
func (m *MyModule) Example(ctx context.Context, parallel int)   {
	return dag.
			Tests().
			Validation(ctx, parallel)
}
@function
async def example(parallel: int) -> None:
	return await (
		dag.tests()
		.validation(parallel)
	)
@func()
async example(parallel: number): Promise<void> {
	return dag
		.tests()
		.validation(parallel)
}