GoogleContainerTools / GoogleContainerTools/container-structure-test

Testing the existence of a directory is very slow

Open
#326 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.5k
Forks
212
PR merge metrics
No merged PRs in 30d

Description

When testing the existence of a directory it appears that if the directory contains many (nested) files, the test takes a considerable amount of time to complete. Is this expected? My assumption is that this test would complete quite quickly. For example, the following test takes 9 seconds to complete on my arm64 macOS 12.6.1 system against the community `nginx` image:

Test:

```
fileExistenceTests:
- name: Root
path: /
shouldExist: true
```

Output (w/ `time`):

```
$ time container-structure-test -v debug test --image nginx --config container-structure.yaml
INFO[0000] container-structure-test &{Version:1.14.0 GitVersion: BuildDate:2022-11-22T13:04:18Z GoVersion:go1.19.3 Compiler:gc Platform:darwin/arm64}

=================================================
====== Test file: container-structure.yaml ======
=================================================
INFO[0000] File Existence Test: Root
DEBU[0009] Skipping empty metadata test
=== RUN: File Existence Test: Work dir exists
--- PASS
duration: 0s

=================================================
==================== RESULTS ====================
=================================================
Passes: 1
Failures: 0
Duration: 0s
Total tests: 1

PASS
container-structure-test -v debug test --image nginx --config 0.16s user 0.62s system 7% cpu 9.943 total
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.