Refactor how skipped tests are defined
Maintainer antworten meist innerhalb von 3 Tagen
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
Beginne damit, die Implementierung von runtime.SkipIf und die im Issue beschriebene bestehende Organisation von mscXXXX_test.go zu lesen. Verfolge, wie build tags Tests auswählen und wie runtime den homeserver erkennt, und vergleiche dieses Verhalten anschließend mit der vorgeschlagenen Benutzerkonfiguration und der auf t.Skipf basierenden Ausführung. Erledigt ist die Aufgabe, wenn das Design auffindbare Testgruppen, eine explizite Benutzerauswahl, deterministisches Überspringen und die Entfernung des von runtime gesteuerten Blacklist-Verhaltens unterstützt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Complement was designed to test the Matrix Specification. However, the spec isn't static and MSCs need tests too. We introduced the build tag system a long time ago to allow tests to opt-in to certain tests. They are defined like this:
//go:build msc3391
// +build msc3391
package tests
// ... rest of code
and used like this:
go test -tags "msc3083 msc3787 msc3874" ./...
The set of tests run is controlled by the user, which can be frustrating when they get out-of-sync: https://github.com/matrix-org/complement/issues/185
This wasn't the end of it though. We also have unique APIs specific to a homeserver, or sometimes some servers don't implement core features which are enabled by default. To fix this, we (ab)use the same build tag system. To opt-out of a test, they are defined like this:
//go:build !dendrite_blacklist
// +build !dendrite_blacklist
package tests
// ... rest of code
and used like this:
go test -tags "dendrite_blacklist" ./...
This was the status quo for a long time, until there was a need to blacklist some tests in the same file but not others. This introduced the runtime package, where you could skip a test in code, rather than conditional compilation. They are defined like this:
func TestRoomImageRoundtrip(t *testing.T) {
runtime.SkipIf(t, runtime.Dendrite)
// .. rest of test
}
A runtime knows what it is by the virtue of the blacklist tag. E.g running -tags "dendrite_blacklist" would skip this test, even if the homeservers were synapse! The code for this is:
//go:build dendrite_blacklist
// +build dendrite_blacklist
package runtime
import (
"context"
"time"
"github.com/docker/docker/client"
)
func init() {
Homeserver = Dendrite
}
This is clearly at odds with testing between heterogeneous homeservers. It's also been questioned if it is the test's job to say what can and cannot run with it. Surely it would be better if it were more tag-like, and the user can opt-in to these tests?
We also have some other ideas for conditional execution of tests based on /versions output: https://github.com/matrix-org/complement/issues/549 . Our forebear, sytest, would automatically skip some tests based on if an earlier test which has a special can_ property did not pass. This is problematic if the can_ test is flakey!
From these use cases, there are some properties we want the test execution API to have:
- granular but not too granular: MSC level is about right. Skipping entire files isn't great as the files are mostly arbitrary collections of tests.
- The user should specify which tests to execute. It's a bit of a smell that Complement dictates this currently via
runtime.SkipIf, and it means that this repository gets touched way too much just to remove these lines as servers get updated. - We don't want the set of tests executed to be nondeterminstic (dependent on a server response or a passing/failing previous test) as that is way too unstable and flakey.
A high-level approach here could be:
- One file per group of tests. Similar to
mscXXXX_test.gofiles. - Make test names part of the public testing API.
- Allow users to specify a set of groups / tests to run / not run.
This would allow us to remove runtime.SkipIf from the codebase, and runtime detection which is flakey and doesn't work with multi-HS support. It also removes the smell of having tests dictate what can/cannot run.
Proposal
- Define a configuration format for specifying the list of groups / test names to run. The list of valid groups/tests must be easily discoverable (autogen from code, like we do with env vars?)
- Read the configuration format and skip appropriately. Always use
t.Skipfinstead of conditional compilation? This would be beneficial as it is not uncommon for conditionally compiled code to break API wise from core (e.g alter a function signature in core, then patch up tests which whine, the mscXXXX files won't whine due to no build tags set by default in the IDE). - This implies some kind of test helper/executor that runs before every test, which isn't ideal as it starts to obfuscate what code runs when you hit test. Could just add it as boilerplate though?
- Vorherrschende Sprache
- Go
- Sterne
- 101
- Forks
- 72
- Ø Merge
- 4 T. 21 Std.
- Gemergte PRs (30 T.)
- 5
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus matrix-org/complement
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
matrix-org/complement#900 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 45/100
matrix-org/complement#938 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
New tests for MSC4354 Sticky EventsEvtl. wieder frei @reivilibre hat das vor 34 Tagen übernommen, und es ist kein Pull Request offen. Offen
matrix-org/complement#925 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 52/100
matrix-org/complement#901 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
matrix-org/complement#899 ·
Maintainer antworten meist innerhalb von 3 Tagen
Alle Issues in matrix-org/complement
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
yetone/magpie#4095 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
docs: Google Safe Browsing flags go-bonnie.dev as "deceptive" (pipe-to-shell install instructions)Offendocumentation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 2 Tagen
-
[Bug]: Telegram bot (v3.11.0): "Ban log" no longer sends the current 3xipl-banned.logEvtl. vergeben @HamedSanaei hat das heute übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
MHSanaei/3x-ui#6990 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 3 Tagen
-
bug(tool/internal/instrument): identical inject_code rules from two rule packages are applied twiceOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
open-telemetry/opentelemetry-go-compile-instrumentation#1611 ·
Maintainer antworten meist innerhalb von 2 Tagen