-
Notifications
You must be signed in to change notification settings - Fork 94
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
testing: sonobuoy plugin for e2e testing #26
Conversation
a813d31
to
1e3c594
Compare
upgradeapiv1 "github.com/rancher/system-upgrade-controller/pkg/apis/upgrade.cattle.io/v1" | ||
) | ||
|
||
var _ = Describe("Upgrade", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everything else in this commit exists to run these three simple tests. will add more once this lands on master
When("plan missing channel and version", func() { | ||
var ( | ||
err error | ||
plan = e2e.NewPlan("unresolvable-", "", nil) | ||
) | ||
BeforeEach(func() { | ||
plan, err = e2e.CreatePlan(plan) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
plan, err = e2e.PollPlanCondition(plan.Name, upgradeapiv1.PlanLatestResolved, 2*time.Second, 30*time.Second) | ||
Expect(err).ToNot(HaveOccurred()) | ||
}) | ||
It("should not resolve", func() { | ||
Expect(upgradeapiv1.PlanLatestResolved.MatchesError(plan, "Error", upgradeapiv1.ErrPlanUnresolvable)).To(BeTrue()) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test for unresolavable plan
When("plan has version", func() { | ||
var ( | ||
err error | ||
plan = e2e.NewPlan("resolve-version-", "", nil) | ||
) | ||
BeforeEach(func() { | ||
plan.Spec.Version = "test" | ||
|
||
plan, err = e2e.CreatePlan(plan) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
plan, err = e2e.PollPlanCondition(plan.Name, upgradeapiv1.PlanLatestResolved, 2*time.Second, 30*time.Second) | ||
Expect(err).ToNot(HaveOccurred()) | ||
}) | ||
It("should resolve", func() { | ||
Expect(upgradeapiv1.PlanLatestResolved.IsTrue(plan)).To(BeTrue()) | ||
Expect(upgradeapiv1.PlanLatestResolved.GetReason(plan)).To(Equal("Version")) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert that a plan with a version resolves
When("plan has channel", func() { | ||
var ( | ||
err error | ||
plan = e2e.NewPlan("resolve-channel-", "", nil) | ||
) | ||
BeforeEach(func() { | ||
plan.Spec.Channel = e2e.ChannelServerURL() | ||
Expect(plan.Spec.Channel).ToNot(BeEmpty()) | ||
|
||
plan, err = e2e.CreatePlan(plan) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
plan, err = e2e.PollPlanCondition(plan.Name, upgradeapiv1.PlanLatestResolved, 2*time.Second, 30*time.Second) | ||
Expect(err).ToNot(HaveOccurred()) | ||
}) | ||
It("should resolve", func() { | ||
Expect(upgradeapiv1.PlanLatestResolved.IsTrue(plan)).To(BeTrue()) | ||
Expect(upgradeapiv1.PlanLatestResolved.GetReason(plan)).To(Equal("Channel")) | ||
}) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert that a plan with a channel resolves
hostname: local-leader | ||
privileged: true | ||
ports: | ||
- "172.17.0.1:6443:6443" # k3s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will the address be always 172.17.0.1 for the host (dapper container i assume?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the default for docker0. This worked for me on a linux box, my mac, and it passed drone so that's good enough for me for now. I do agree that this should be more flexible in the future but I just wanted to get it off my plate.
context: ./images/k3s/. | ||
args: | ||
- ARCH=${ARCH} | ||
command: server --no-deploy=traefik,metrics-server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use disable here instead of no-deploy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--disable
doesn't yet seem to be available in a release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it
|
||
services: | ||
|
||
leader: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think server/agent nomenclature is more accurate than leader/worker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO these are too generic for this purpose.
@@ -0,0 +1,29 @@ | |||
# Install the all-in-one binary so we can copy our run-time images into the image |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason you are not using the official Image directly in the docker-compose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I tried to capture in this comment. I have to recreate a k3s image because the official image declares /var/lib/rancher
as a VOLUME which means subsequent additions to that area will never show up in an image. If, however, in a Dockerfile you copy content into a location and then declare it a VOLUME afterwards and then run the image with an non-bind mount volume at that location, docker will by default at first-run copy the contents from the image into the volume. This is the trick that I am leveraging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks for clarification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other reason I need to re-create a k3s image is because I want the tests to run locally without the need to pull anything which means I need the images tarballs in the k3s image. Doing that via docker-compose within Dapper is problematic because the docker daemon it is using does not have the same filesystem root that the host does which means bind mounts are hopeless.
@@ -0,0 +1,14 @@ | |||
#!/usr/bin/env bash | |||
|
|||
set -e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe a DEBUG
variable can be useful here to give more visibility with -x for example
from_secret: docker_password | ||
platforms: | ||
- linux/amd64 | ||
- linux/arm64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason arm is not included here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is currently no sonobuoy client built for arm therefore pushing an arm image isn't necessary right now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dweomer explained the questions/comments that I had, LGTM. thanks 👍
- includes removal of controller serviceAccountName references and envvar - image tarballs a la `docker save` are added to dist/artifacts - sonobuoy plugin yaml added to dist/artifacts - introduces e2e-tests tag suffix image that can be used for the sonobuoy plugin
1e3c594
to
b53bd3b
Compare
docker save
are added to dist/artifacts