Skip to content

Commit db1f6a7

Browse files
committed
kola: Force exclusive: false tests to use ProtectSystem=strict
Part of my war against duplicative comments in our kola tests. We have a few tests that write a comment like this: ``` # - exclusive: false # - This test doesn't make meaningful changes to the system and # should be able to be combined with other tests. ``` Of course, this comment is already redundant because the meaning of the `exclusive` tag is defined canonically in coreos-assembler (here) and copy-pasting that into every test that uses it would be pointlessly verbose. But - we can do one better. Instead of having this flag be an "I promise not to mutate the system" field, we can *enforce* it. Then it doesn't need to be commented - if someone later tries to change an `exclusive: false` test to mutate things, the test will *fail*. The behavior is hence more self-documenting and enforcing. Some tests need adjustment for this.
1 parent 3991e6f commit db1f6a7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

mantle/kola/harness.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,12 @@ Environment=KOLA_TEST_EXE=%s
980980
Environment=%s=%s
981981
ExecStart=%s
982982
`, unitName, testname, base, kolaExtBinDataEnv, destDataDir, remotepath)
983+
// Force exclusive tests to not affect the system
984+
if !targetMeta.Exclusive {
985+
unit += (`ProtectSystem=strict
986+
PrivateTmp=yes
987+
`)
988+
}
983989
if targetMeta.InjectContainer {
984990
if CosaBuild == nil {
985991
return fmt.Errorf("test %v uses injectContainer, but no cosa build found", testname)

0 commit comments

Comments
 (0)