question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test artifacts not copying

See original GitHub issue

Bug

Test artifacts are not being copied locally.

Current Behavior

Test is successfully run without extracting the tarball or copying to local artifact directory. Looks like it fails silently before reaching the runner.

Expected behavior

Test artifacts are copied locally!

Reproducible example

A full working example can be created (if necessary) but it is easier to just attach some relevant parts of my stack.

  1. abbreviated garden.yaml
kind: Module
type: container
name: functional-testing
tests:
  - name: spawner
    command: ["/bin/sh","-c"]
    args: ["coverage run ..."]
    env: {
      COVERAGE_FILE: "/app/.coverage"
    }
    artifacts:
      - source: /app/.coverage
        target: ./coverage/spawner
  1. triggering tests
$ garden test functional-testing -n spawner --log-level 5 --force

...
...

ℹ Remaining tasks 1
ℹ tasks                     → Processing task test.functional-testing.spawner.ff584ad0-c693-11ea-8923-51392d05c2ab
Currently in progress [test.functional-testing.spawner.ff584ad0-c693-11ea-8923-51392d05c2ab]
ℹ functional-testing        → Running spawner tests
   Getting 'testModule' handler for module 'functional-testing' (type 'container')
Resolving provider kubernetes
   Calling testModule handler for module functional-testing
   Starting Pod test-functional-testing-spawner-41b08d with command 'sh -c mkfifo /tmp/output && cat /tmp/output && sleep 86400'
   Spawning '/Users/jfriedman/.garden/tools/kubectl/b57d7033ebdf2a5a/kubectl --context=XXX namespace=joshfri run test-functional-testing-spawner-41b08d --image=XXX --restart=Never -i --overrides {"metadata":{"annotations":{"sidecar.istio.io/inject":"false"}},"spec":{"containers":[{"name":"main","image":"XXX","env":[{"name":"GARDEN_VERSION","value":"v-bb8fb4b250"},{"name":"GARDEN_DEPENDENCIES","value":"[]"},{"name":"COVERAGE_FILE","value":"/app/.coverage"}],"volumeMounts":[],"command":["sh","-c","mkfifo /tmp/output && cat /tmp/output && sleep 86400"]}],"imagePullSecrets":[],"volumes":[]}} --quiet' in /Users/jfriedman/.garden/tools/kubectl/b57d7033ebdf2a5a
   Execing '/Users/jfriedman/.garden/tools/kubectl/b57d7033ebdf2a5a/kubectl --context=XXX --namespace=joshfri exec -i test-functional-testing-spawner-41b08d -c main -- sh -c tar --help' in /Users/jfriedman/.garden/tools/kubectl/b57d7033ebdf2a5a
   Execing '/Users/jfriedman/.garden/tools/kubectl/b57d7033ebdf2a5a/kubectl --context=XXX --namespace=joshfri exec -i test-functional-testing-spawner-41b08d -c main -- sh -c exec >/tmp/output; "/bin/sh" "-c" "coverage run ..."' in /Users/jfriedman/.garden/tools/kubectl/b57d7033ebdf2a5a
   Execing '/Users/jfriedman/.garden/tools/kubectl/b57d7033ebdf2a5a/kubectl --context=XXX --namespace=joshfri exec -i test-functional-testing-spawner-41b08d -c main -- sh -c cd / && touch .DS_Store && tar -c -f - $(ls app/.coverage 2>/dev/null) .DS_Store' in /Users/jfriedman/.garden/tools/kubectl/b57d7033ebdf2a5a
   tar: got file app/.coverage
   tar: got file .DS_Store
✔ functional-testing        → Running spawner tests → Success (took 22.4 sec)
✔ tasks                     → Completed task test.functional-testing.spawner.ff584ad0-c693-11ea-8923-51392d05c2ab (took 22.377 sec)
ℹ Remaining tasks 0
ℹ Remaining tasks 0

Workaround

Using PVCs.

Your environment

$ garden version
0.12.0

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.6-beta.0", GitCommit:"e7f962ba86f4ce7033828210ca3556393c377bcc", GitTreeState:"clean", BuildDate:"2020-01-15T08:26:26Z", GoVersion:"go1.13.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"15+", GitVersion:"v1.15.9-gke.24", GitCommit:"39e41a8d6b7221b901a95d3af358dea6994b4a40", GitTreeState:"clean", BuildDate:"2020-02-29T01:24:35Z", GoVersion:"go1.12.12b4", Compiler:"gc", Platform:"linux/amd64"}

$ docker version
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:21:11 2020
 OS/Arch:           darwin/amd64
 Experimental:      false

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
eysi09commented, Jul 16, 2020

Ok understood. If there’s a file called .coverage there it should of course work. Just wanted to verify that this wasn’t an issue with the path or that the file wasn’t there.

I haven’t been able to reproduce this on my end. I tried this with a very similar setup but just not using coverage. Any chance you could whip up a simple standalone repro for me? That would make it much easier to debug this.

0reactions
stale[bot]commented, Sep 17, 2020

This issue has been automatically marked as stale because it hasn’t had any activity in 60 days. It will be closed in 14 days if no further activity occurs (e.g. changing labels, comments, commits, etc.). Please feel free to tag a maintainer and ask them to remove the label if you think it doesn’t apply. Thank you for submitting this issue and helping make Garden a better product!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Copying test artifacts - IBM
Test artifacts can be reused by copying existing artifacts. The copied artifacts can then be modified without affecting the original test artifact.
Read more >
Artifacts are not copied with "run test" command #1739 - GitHub
Run garden run test <module-name> <test-name> in a project that stores artifacts and notes that they're not copied to the .garden dir.
Read more >
Cloning test artifacts - Jazz.net
You can duplicate artifacts across projects when you specify a target stream, but if you duplicate artifacts within one project you can not...
Read more >
Azure DevOps copy additional files to published artifacts
You should use the copy task to copied the required content to the specified folder in folder $(Build.ArtifactStagingDirectory) before ...
Read more >
Use artifacts in steps | Bitbucket Cloud - Atlassian Support
Manual steps will have build artifacts produced by any previous steps copied into their working directory, similar to automatic steps. Artifact downloads and ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found