@@ -161,8 +161,8 @@ func WithContainerCLI(ccli ContainerCLI) Option {
161
161
162
162
// WithContainerLabelIncludeFilter sets a label filter for containers.
163
163
// This option can be given multiple times to filter by multiple labels.
164
- // The behavior is such that only containers matchingone or more of the
165
- //provided labels will be included.
164
+ // The behavior is such that only containers matchingall of the provided
165
+ // labels will be included.
166
166
func WithContainerLabelIncludeFilter (label ,value string )Option {
167
167
return func (api * API ) {
168
168
api .containerLabelIncludeFilter [label ]= value
@@ -927,13 +927,18 @@ func (api *API) processUpdatedContainersLocked(ctx context.Context, updated code
927
927
slog .F ("config_file" ,configFile ),
928
928
)
929
929
930
+ // If we haven't set any include filters, we should explicitly ignore test devcontainers.
931
+ if len (api .containerLabelIncludeFilter )== 0 && container .Labels [DevcontainerIsTestRunLabel ]== "true" {
932
+ continue
933
+ }
934
+
930
935
// Filter out devcontainer tests, unless explicitly set in include filters.
931
- if len (api .containerLabelIncludeFilter )> 0 || container . Labels [ DevcontainerIsTestRunLabel ] == "true" {
932
- var ok bool
936
+ if len (api .containerLabelIncludeFilter )> 0 {
937
+ ok := true
933
938
for label ,value := range api .containerLabelIncludeFilter {
934
- if v ,found := container .Labels [label ]; found && v == value {
935
- ok = true
936
- }
939
+ v ,found := container .Labels [label ]
940
+
941
+ ok = ok && ( found && v == value )
937
942
}
938
943
// Verbose debug logging is fine here since typically filters
939
944
// are only used in development or testing environments.