-
Notifications
You must be signed in to change notification settings - Fork 71
Conversation
35b4f22
to
d6db8f2
Compare
tests/cdi/cdi_test.go
Outdated
}) | ||
}) | ||
|
||
func WriteJson(name string, json string) (string, error) { |
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.
are suppose the following 3 funcs are here until PR kubevirt/kubevirt#980 will get merged.
after that there is no point in this code duplication. we will just need to import utils.go
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, once that pr got merged, I will rebase my pr here.
tests/cdi/cdi_test.go
Outdated
|
||
// template parameters | ||
const ( | ||
pvcEPHTTPNOAUTHURL = "https://raw.githubusercontent.com/shiywang/kubevirt-ansible/add_vm/tests/images/testvm.qcow2" |
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 guess we need to setup a place with all images in it.
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.
yeah, I have a pr to push a small test image (~13mb) to github repo here: #245, but if you think that's not a good idea, maybe we should put images in some registry or cdn or some http service ? I just don't know where could we have the place to put those images right now : -/
roles/cdi/defaults/main.yml
Outdated
repo_tag: "{{ cdi_repo_tag | default('jcoperh') }}" | ||
release_tag: "{{ cdi_release_tag | default('latest') }}" | ||
repo_tag: "{{ cdi_repo_tag | default('kubevirt') }}" | ||
release_tag: "{{ cdi_release_tag | default('v0.5.0-alpha.0') }}" |
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.
IF CDI repo is really going to follow the same versions as kubevirt, i would keep only 1 param
also not sure about this default... i would prefer to not have a default and fail, than to run on a version somebody put here god knows how long ago, or would use latest and if it fails at least you know the latest version is not working
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.
yeah, I guess we can eliminate cdi_repo_tag
by hard coding it into template, but I guess this is also fine ? I would like to keep it cuz sometime it maybe more easy for debugging, but for this case since there's only one yaml file here, so I guess I don't have strong opinion on keep one parameter or two.
also not sure about this default... i would prefer to not have a default and fail, than to run on a version somebody put here god knows how long ago, or would use latest and if it fails at least you know the latest version is not working
Yeah, this is what I suggested using latest and I filed an issue here: kubevirt/containerized-data-importer#177, but seems they didn't use the latest
tag on purpose.
133f956
to
07df419
Compare
97daeec
to
1c4e4b6
Compare
4d343cc
to
cb2b537
Compare
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 don't see the
cdi controller
and data importer pod
logs in
https://jenkins.ovirt.org/job/kubevirt_kubevirt-ansible_standard-check-pr/880/artifact/exported-artifacts/check-patch.openshift_3-9.el7.x86_64/vms_logs/
Do those pods write any logs?
tests/cdi/cdi_test.go
Outdated
var _ = Describe("CDI create importer-pod write images into pv", func() { | ||
flag.Parse() | ||
|
||
overrideTemplateFromParameters := func(srcFilePath, DstFilePath string, params ...string) string { |
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.
s/DstFilePath/dstFilePath
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.
fixed
tests/cdi/cdi_test.go
Outdated
By(fmt.Sprintf("Creating %s:%s from JSON file via oc-create command", resourceType, resourceName)) | ||
out, err := RunOcCommand("create", "-f", filePath) | ||
Expect(err).ToNot(HaveOccurred()) | ||
message = fmt.Sprintf(resourceType+" \"%s\" created\n", resourceName) |
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.
Why do you need to check the message? return code isn't enough?
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.
removed
tests/cdi/cdi_test.go
Outdated
} | ||
}) | ||
|
||
It("create pvc and vm should success", 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.
I think that this assertion should be split into three parts (so in case of a failure we will know where to look):
- Verify that CDI populated the PVC
- Verify that the PVC is attached to the VM.
- Verify that the VM is functional (maybe using SSH?) - this way we ensure that the image didn't get corrupted during the import process.
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.
@gbenhaim not sure, I saw the logs here: http://jenkins.ovirt.org/job/kubevirt_kubevirt-ansible_standard-check-pr/882/consoleFull, the tests case runs well and on my local env I can check pod logs using @gbenhaim |
Lago collects |
@gbenhaim this is a tricky problem, here is my logs on my nodes, but I don't know why lago doesn't collect those, when I use oc logs to debug
|
tests/cdi/test-vm.yml
Outdated
creationTimestamp: null | ||
name: cdi-test | ||
objects: | ||
- apiVersion: kubevirt.io/v1alpha1 |
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 think this should get updated to v1alpha2,
i wonder how can we keep it up-to-date with moving versions
maybe it should be a param as well, but need to figure out where to bring it from
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.
@shiywang Please see the comments.
To deploy KubeVirt on an existing OpenShift cluster run the command below. For more information on clusters and other deployment scenarious see [playbooks instructions](./playbooks/README.md). | ||
|
||
``` | ||
ansible-playbook -i localhost playbooks/kubevirt.yml -e@vars/all.yml | ||
``` | ||
>**Note:** Check default variables in [vars/all.yml](./vars/all.yml) and update them if needed. | ||
|
||
### E2E Testing |
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.
@shiywang IMHO, It's more user-friendly to give instructions/steps in a form of a numerated list. First, the description of what should be done is given, and then how to do it. The usage instructions/steps go well with the imperative mood.
For example:
- Login into the cluster (or Ensure it is possible to login into the cluster)
oc login
- Compile tests inside the docker container and copy it to ....
make generate-tests
- Run tests ...
make test
- ...
README.md
Outdated
To deploy KubeVirt on an existing OpenShift cluster run the command below. For more information on clusters and other deployment scenarious see [playbooks instructions](./playbooks/README.md). | ||
|
||
``` | ||
ansible-playbook -i localhost playbooks/kubevirt.yml -e@vars/all.yml | ||
``` | ||
>**Note:** Check default variables in [vars/all.yml](./vars/all.yml) and update them if needed. | ||
|
||
### E2E Testing | ||
|
||
After a successful deployment or using an exist cluster, make sure you can `oc login` into cluster. |
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.
- Don't use
command
as a verb in documentation. - s/using an exist cluster/using the existing cluster
- s/into cluster/into the cluster
README.md
Outdated
``` | ||
make generate-tests | ||
``` | ||
Will compile tests from tests inside docker container and copy it to _out directory inside kubevirt-ansible repository. |
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.
- Tests from Tests? Tests are already inside and some will be compiled in the same container? It's a very confusing phrase. Maybe:
Compile tests which are inside THE docker container
? - s/to _out directory/to the
_out
directory - s/kubevirt-ansible repository/the
kubevirt-ansible
repository
README.md
Outdated
``` | ||
make test | ||
``` | ||
Will run all the e2e tests with kubeconfig from `~/.kube/config`, or you can pass it to tests via: |
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.
Run all the e2e tests with/using the ~/.kube/config
file, or ...
README.md
Outdated
./_out/tests/<name>.test -kubeconfig=your_kubeconfig -tag=kubevirt_images_tag -prefix=kubevirt -test.timeout 60m | ||
``` | ||
|
||
If you want to test PVC's `storage.import.endpoint` with different/internal images, we provided an ENV called `STREAM_IMAGE_URL` which you can set up in your own environment like: |
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.
avoid WE in docs:
To test PVC's storage.import.endpoint
with other images, use the STREAM_IMAGE_URL
environment variable:
README.md
Outdated
|
||
If you want to test PVC's `storage.import.endpoint` with different/internal images, we provided an ENV called `STREAM_IMAGE_URL` which you can set up in your own environment like: | ||
``` | ||
export STREAM_IMAGE_URL=https://test.net/0.1.0/internal-test-vm.img |
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 it some sample URL? If so, i would change it for =<the_image_url>
Is it related to #305 ? |
tests/cdi/cdi_suite_test.go
Outdated
// Wait until the namespaces are terminated | ||
fmt.Println("") | ||
for _, namespace := range testNamespaces { | ||
fmt.Printf("Waiting for namespace %s to be removed, this can take a while ...\n", namespace) |
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.
Simply: "Removing the %s namespace. It can take some time."
tests/cdi/cdi_test.go
Outdated
url = pvcEPHTTPNOAUTHURL | ||
} | ||
|
||
Context("with valid image url will succeed", 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.
what will succeed?
tests/util.go
Outdated
) | ||
|
||
func ProcessTemplateWithParameters(srcFilePath, dstFilePath string, params ...string) string { | ||
By(fmt.Sprintf("Overriding template from %s to %s", srcFilePath, dstFilePath)) |
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 template
tests/util.go
Outdated
func writeJson(jsonFile string, json string) (string, error) { | ||
err := ioutil.WriteFile(jsonFile, []byte(json), 0644) | ||
if err != nil { | ||
return "", fmt.Errorf("failed to write json file %s", jsonFile) |
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 json file
tests/util.go
Outdated
} | ||
|
||
func createResourceWithFilePath(resourceType, resourceName, filePath, nameSpace string) { | ||
By(fmt.Sprintf("Creating %s:%s from JSON file via oc-create command", resourceType, resourceName)) |
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 json file
- via/with
- the oc-create command
7ebe59d
to
e7a94bc
Compare
} | ||
|
||
var _ = BeforeSuite(func() { | ||
virtCli, err := kubecli.GetKubevirtClient() |
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 change to use CreateNamespace
once kubevirt/kubevirt#1343 merged
baf2a36
to
19ccecf
Compare
@gbenhaim @aglitke yeah, it is really weird, my debug pr got passed which is exactly same as this one, oh, the only difference is here: 7be3d68#diff-1c9e6b58cf30323b99cfe0468b617262R6, so I think it may releated to #305 I guess ? |
This one passed #325 |
tests/cdi/cdi_test.go
Outdated
}) | ||
|
||
Specify("the PVC should become bound", func() { | ||
tests.WaitUntilResourceReadyByNameTestNamespace("pvc", pvcName, "-o=jsonpath='{.metadata.annotations}'", "pv.kubernetes.io/bind-completed:yes pv.kubernetes.io/bound-by-controller:yes") |
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.
Since annotations are maps I don't think you can rely on the order of 2 annotations. It is more reliable and accurate to test each annotation value separately, imo.
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 guess I can only keep one, pv.kubernetes.io/bind-completed:yes
is already enough.
tests/cdi/cdi_test.go
Outdated
}) | ||
|
||
Specify("the importer-pod should become completed", func() { | ||
tests.WaitUntilResourceReadyByLabelTestNamespace("pod", "app=containerized-data-importer", "-o=jsonpath='{.items[0].status.phase}'", "Succeeded") |
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.
how do you know the 1st pod listed (matching the label) is the pod you're interested in? I think this test is too imprecise.
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.
because I only created one and I didn't find any other labels to match more imprecisely. do you have better suggestions? if not maybe we should create an issue for CDI repo, to add more precise labels to importer-pod?
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 was thinking that maybe namespace (which is random-ized) would be a good additional filter. But if you have full control of the test env such that you know no other cdi tests will run in parallel with this test then what you have here is fine. My comment is not about the value of the label but that there can potentially be >1 importer pod if more than one cdi test is run at the same time.
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.
thank you for the suggestion, I will create an issue for that about the randomized namespace and more than one pod conflicts, will do that in a follow-up pr
Signed-off-by: Shiyang Wang <shiywang@redhat.com>
Signed-off-by: Shiyang Wang <shiywang@redhat.com>
Signed-off-by: Shiyang Wang <shiywang@redhat.com>
Signed-off-by: Shiyang Wang <shiywang@redhat.com>
@aglitke @jeffvance updated, PTAL |
@lukas-bednar @nellyc could you help me merge this pr ? thank you so much !! |
This pr rely on kubevirt/kubevirt#980
Signed-off-by: Shiyang Wang shiywang@redhat.com