Skip to content

MockSubprocessDependencyBuilder.mocks is not thread safe #33

@evan-olcott-jamf

Description

@evan-olcott-jamf

This code will crash on MockSubprocessDependencyBuilder.swift:123 when separate threads try to add a new mock to the mocks array.

    @Test("Multi-argument test. Each argument is run in a different thread.",
          arguments: [Log.Level.diagnostic, .verbose, .debug, .info])
    func multiArgumentTest(level: Log.Level) async throws
    {
        for subsystem in Self.subsystems {
            Subprocess.expect([
                "usr/bin/log",
                "config",
                "--subsystem", subsystem
            ])
        }
        
        ...

        try Subprocess.verify()
    }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions