Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Agent] agent docker runtime unit test require docker #770

Closed
jacobweinstock opened this issue Jul 17, 2023 · 1 comment · Fixed by #771
Closed

[Agent] agent docker runtime unit test require docker #770

jacobweinstock opened this issue Jul 17, 2023 · 1 comment · Fixed by #771

Comments

@jacobweinstock
Copy link
Member

The https://github.com/tinkerbell/tink/tree/main/internal/agent/runtime package unit tests require Docker to be installed. Do we want this to be a dependency for unit tests? Also, i have an Ubuntu 22.04 system with Docker (24.0.2) and TestDockerImageNotPresent is failing for me. output:

--- FAIL: TestDockerImageNotPresent (0.02s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x9a05a5]

goroutine 19 [running]:
testing.tRunner.func1.2({0xa28c00, 0xfa4140})
        /nix/store/kfpv1z26wn481yv5z1vzakla8fllhggn-go-1.20.4/share/go/src/testing/testing.go:1526 +0x24e
testing.tRunner.func1()
        /nix/store/kfpv1z26wn481yv5z1vzakla8fllhggn-go-1.20.4/share/go/src/testing/testing.go:1529 +0x39f
panic({0xa28c00, 0xfa4140})
        /nix/store/kfpv1z26wn481yv5z1vzakla8fllhggn-go-1.20.4/share/go/src/runtime/panic.go:884 +0x213
github.com/tinkerbell/tink/internal/agent/runtime_test.TestDockerImageNotPresent(0xc0001036c0)
        /home/tink/repos/tinkerbell/tink/internal/agent/runtime/docker_test.go:47 +0x4e5
testing.tRunner(0xc0001036c0, 0xb248a0)
        /nix/store/kfpv1z26wn481yv5z1vzakla8fllhggn-go-1.20.4/share/go/src/testing/testing.go:1576 +0x10b
created by testing.(*T).Run
        /nix/store/kfpv1z26wn481yv5z1vzakla8fllhggn-go-1.20.4/share/go/src/testing/testing.go:1629 +0x3ea
FAIL    github.com/tinkerbell/tink/internal/agent/runtime       0.029s

When I updated the test to output differently i get this:

go test -timeout 30s -run ^TestDockerImageNotPresent$ github.com/tinkerbell/tink/internal/agent/runtime -race

--- FAIL: TestDockerImageNotPresent (2.04s)
    /home/tink/repos/tinkerbell/tink/internal/agent/runtime/docker_test.go:47: deleting image (sha256:9e179bacf43c4d3428d57cf459799ba0285b901945f9eccb17b6da056d3532c7): Error response from daemon: conflict: unable to delete 9e179bacf43c (cannot be forced) - image has dependent child images; deleting image (sha256:042a816809aac8d0f7d7cacac7965782ee2ecac3f21bcf9f24b1de1a7387b769): Error response from daemon: conflict: unable to delete 042a816809aa (cannot be forced) - image has dependent child images; deleting image (sha256:6b5c5e00213a401b500630fd8a03f6964f033ef0e3a6845c83e780fcd5deda5c): Error response from daemon: conflict: unable to delete 6b5c5e00213a (cannot be forced) - image has dependent child images

So it appears that this is dependent on the alpine image not being used by any started containers.

Expected Behaviour

Current Behaviour

Possible Solution

  • One possible option is to make these test optional and opt in only.
  • Another option is to use a different container image. hello-world for example.

Steps to Reproduce (for bugs)

Context

Your Environment

  • Operating System and version (e.g. Linux, Windows, MacOS):

  • How are you running Tinkerbell? Using Vagrant & VirtualBox, Vagrant & Libvirt, on Packet using Terraform, or give details:

  • Link to your project or a code example to reproduce issue:

@chrisdoherty4
Copy link
Member

This was a trade-off for having some test coverage as noted in #730. We didn't create a ticket for introducing the integration test suite though.

Re the specific test issue I think we should treat it as a separate issue - and oversight for sure.

@mergify mergify bot closed this as completed in #771 Jul 17, 2023
mergify bot added a commit that referenced this issue Jul 17, 2023
…nc (#771)

## Description


This allows for using the formatPartition func for more device types. `vd*` is a device created by virtio. `hd*` for legacy IDE hard disks.

Also use `hello-world` image instead of `alpine` in the `TestDockerImageNotPresent` unit test.

## Why is this needed



Fixes: #770 

## How Has This Been Tested?





## How are existing users impacted? What migration steps/scripts do we need?





## Checklist:

I have:

- [ ] updated the documentation and/or roadmap (if required)
- [ ] added unit or e2e tests
- [ ] provided instructions on how to upgrade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants