GoogleContainerTools / container-structure-test

validate the structure of your container images

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Testing the existence of a directory is very slow

mattupstate opened this issue · comments

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