#Better Cloud Tests 🧵

1 messages Ā· Page 1 of 1 (latest)

rough glen
#

Goal: tests are easily visible in cloud UI without expanding a million things, similar to Checks UI simplification

#

@dawn ether there are standard semconv attributes we can use now: https://opentelemetry.io/docs/specs/semconv/registry/attributes/test/

I'm adding support for it in testctx now

OpenTelemetry

Test Attributes This group describes attributes specific to software tests.
Attributes:
Key Stability Value Type Description Example Values test.case.name string The fully qualified human readable name of the test case. org.example.TestCase1.test1; example/tests/TestCase1.test1; ExampleTestCase1_test1 test.case.result.status string The status of...

#

the attributes are kind of dumb tbh. i don't know why suite has such expressive ending states, but case is just pass/fail. I decided to just use suite for that, but still set case name. shrug

rough glen
modern canyon
#

How does Dagger determine if something is a test? I would still rate the addition of a +test that produced some really basic junit output (function name, pass/fail, execution duration)

rough glen
# modern canyon How does Dagger determine if something is a test? I would still rate the additio...

The UI recognizes the test.case.name span attribute referenced above, and uses presence of those spans as a strong hint for the UI to show a simplified list of the tests, instead of a raw trace. We'll support JUnit too, probably by just re-emitting it as OTel spans. Beyond trivial UI stuff, @warm seal is also cooking up some plans for how tests are represented in the DAG, to support test splitting / reruns / etc. in a nice consistent way

warm seal
#

@rough glen are those standard spans that test tooling may already be emitting? Or our own invention?

#

(the otel stack is so sprawling, I wouldn't be surprised if a committee somewhere already formalized attributes)

rough glen
#

standard šŸŽ‰ - they must have added them recently ish, they didn't exist when testctx was created

warm seal
#

They're vibe-standardizing

#

Nice nice

#

That opens the possibility of open compat bridges between junit and otel then?

#

In either direction

rough glen
rough glen
warm seal
#

Amazing šŸ™‚

#

If you're starting to think about grouping tests over time (for analytics, flake detection etc), I have useful architectural scaffolding for you , the design docs are far along enough to be worth reading.

artifacts.md + collections.md

Between those two, you get stable coordinate system to locate the span-emitting object, across time, workspaces, and even across schema-path changes

#

I'm most curious how the idea of a coordinate system informs web UI. Examples of things that have coordinates: SQL rows... spreadsheet rows... We're in familiar territory for web dev; tables, lists, filters, etc.

#

Also: I think a TUI equivalent of "test view" would be amazing for local dev loop šŸ™‚

rough glen
#

https://asciinema.org/a/904712

Found a zero-config way to do go test => OTel šŸŽ‰

Went through a few iterations, best option came down to a drop-in go test replacement, otelgotest. Tries to be even more transparent than gotestsum which takes a similar approach but has its own set of flags and needs -- to disambiguate. otelgotest on the other hand is as close to a pass-through as possible.

More details: https://github.com/dagger/otel-go/pull/2

Recorded by vito

GitHub

Adds two CLIs:

./cmd/otelgotest: a drop-in go test replacement that emits test data to OpenTelemetry

usage: otelgotest ./... (same flags as go test, just passes through)

./cmd/oteljunit: loads ...

rough glen
warm seal
#

@rough glen side bar looks awesome, but right part is stuck on loading

#

(first link)

rough glen
#

ah weird, same for me. as a workaround you can toggle between the Trace and Tests UI

warm seal
#

Every time I toggle it prompts me with the org chooser

#

Note the "dagger / viewing"

rough glen
#

tried to repro the org switcher issue by swapping to my org and clicking the link, but couldn't. (it does say 'viewing' but switches OK)

#

there's some known jank with the url handling already so hopefully whatever demon is lurking there gets exorcised along the way

rough glen
#

@normal basin @swift eagle could use a āœ… on https://github.com/dagger/otel-go/pull/2 - I rebased it on top of the otel bump, and it's all additive so shouldn't break anything. My plan is to eventually integrate this with dagger/go around here so Go tests automatically get emitted as OTel.