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

e2e, Introduce e2e test: resolving a FQDN entry #38

Merged
merged 6 commits into from
Dec 6, 2022
Merged

Conversation

AlonaKaplan
Copy link
Member

@AlonaKaplan AlonaKaplan commented Dec 4, 2022

The test is creating a VMI with one multus and no default interface and verifies that nslookup to the interface fqdn retrieves the correct IP.

The PR also contains -

  • Enable deploying kubevirt and cnao on cluster-up.
  • Changing the number of nodes in the ci cluster to 1 (it is enough for now).
  • Updating the functest.sh to run the e2e test.

@kubevirt-bot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kubevirt-bot kubevirt-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/XXL labels Dec 4, 2022
Signed-off-by: Alona Paz <alkaplan@redhat.com>
Currently one node is enough for us.
The cluster has forwarding from 127.0.0.1:31111 to the node01.
By having only one node we make sure the dns query is forwarding to the
correct node.

Signed-off-by: Alona Paz <alkaplan@redhat.com>
Those are needed for the e2e test wihich creates a VM with multus
interface.

Signed-off-by: Alona Paz <alkaplan@redhat.com>
@AlonaKaplan AlonaKaplan marked this pull request as ready for review December 4, 2022 17:12
@kubevirt-bot kubevirt-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 4, 2022
@oshoval
Copy link
Collaborator

oshoval commented Dec 5, 2022

About nslookup binary
I think we should do the following as part of hack/functest.sh

[ "$CI" == "true" ] && dnf install bind-utils (*)

if ! nslookup www.google.com > /dev/null 2>&1; then
  echo error
  exit 1
fi

So on both local and on CI, it will directly fail as first step if the binary doesn't exists
the (*) will make it work on CI for now of course, and once we add it to the bootstrap image we can remove it.
It might take time until it is merged, and a new image + bump exists, so IMO it is more comfortable to use (*) first
and do it in the bootstrap in parallel.
We should not install stuff locally as part of the e2e tests, nor require sudo to run the tests.
On CI we don't need sudo.
bootstrap file images/bootstrap/Dockerfile

Copy link
Collaborator

@oshoval oshoval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thanks
First pass

Please update PR desc to
e2e, Introduce e2e test: resolving a FQDN entry
or something like that

typo on the last line of the PR desc (file name missing dot)

cluster/up.sh Show resolved Hide resolved
hack/functest.sh Outdated
@@ -1,3 +1,8 @@
#!/bin/bash -e
#!/usr/bin/env bash
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please keep the previous shebang, this is the one we use all over

plus remove plesase the set -xe

const pollingInterval = 5 * time.Second
const testNamespace = "secondary-test"
const dnsPort = "31111"
const dnsIP = "127.0.0.1" // Forwarded to the node port - https://github.com/kubevirt/kubevirtci/pull/867 ,https://github.com/kubevirt/kubesecondarydns/pull/23
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we need the comments

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no chance that external contributor or even future us will understand why "127.0.0.1" is the dnsIP without thos comment.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so maybe just something generic as this is the flow of kubevirtci ?
or even just the 2nd PR can be enough ?
two PRs is way too much imo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think those two PR explain the best how we rich the dns. I prefer to have it and to same future developer some time in the future.

Copy link
Collaborator

@oshoval oshoval Dec 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am personally against too much comments / links
if we can find something in between it would be great please
btw the first link has info about the node port as well

Copy link
Collaborator

@oshoval oshoval Dec 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that even now the PRs are outdated, because the was another PR which change kuevirtci default host port from 53 to 31111
this is the problem with comments

I think we can mention here the README.md, that once the PR of readme is merged, it explains a bit about the topology we are using on kubevirtci / nodeport

Comment on lines +141 to +125
Config: `{
"cniVersion": "0.3.1",
"name": "mynet",
"plugins": [
{
"type": "ptp",
"ipam": {
"type": "static",
"addresses": [
{
"address": "10.10.0.5/24",
"gateway": "10.10.0.254"
}
]
}
}
]
}`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe lets do it go style?
unless it required lots of packages

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean by go style?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the config is a sting.

Copy link
Collaborator

@oshoval oshoval Dec 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right maybe better to declare it as a string on top and use it ? (like kubevirt's newNetworkAttachmentDefinition)

btw alternative indentations if you prefer
This one is what user-guide of kubevirt use

  config: '{
      "cniVersion": "0.3.1",
      "name": "mynet",
      "plugins": [
        {
          "type": "ptp",
          "ipam": {
            "type": "static",
            "addresses": [
                {
                  "address": "10.10.0.5/24",
                  "gateway": "10.10.0.254"
                }
            ]
          }
        }
      ]
    }'

This one is what yq pretty prints
(on kubevirt we also have one liners like this)

'{ "cniVersion": "0.3.1", "name": "mynet", "plugins": [ { "type": "ptp", "ipam": { "type": "static", "addresses": [ { "address": "10.10.0.5/24", "gateway": "10.10.0.254" } ] } } ] }'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the one liner less readable.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about the fixed ident ?

const testNamespace = "secondary-test"
const dnsPort = "31111"
const dnsIP = "127.0.0.1" // Forwarded to the node port - https://github.com/kubevirt/kubevirtci/pull/867 ,https://github.com/kubevirt/kubesecondarydns/pull/23
const domain = "vm.secondary.io"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider #36
and then it should be just "vm"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's not merged yet so I cannot consider it:) #36 will have to fix the e2e if the e2e will be merged first.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you review it please and lets merge it ? it is an easy one and lgtmed

hack/functest.sh Outdated
source ./cluster/cluster.sh

export KUBEVIRT_CLIENT_GO_SCHEME_REGISTRATION_VERSION=v1
KUBECONFIG=${KUBECONFIG:-$(cluster::kubeconfig)} $GO test -test.timeout=1h -race -test.v ./tests/... $E2E_TEST_ARGS -ginkgo.v
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have twice -v, lets remove the deprecated one

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which one of the is deprecated?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the ginkgo one
best to try please the different ways

Comment on lines 33 to 42
BeforeEach(func() {
By("Creating test namespace")
ns := k8sv1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: testNamespace,
},
}
err := getClient().Create(context.Background(), &ns)
Expect(err).ToNot(HaveOccurred(), "couldn't create namespace for the test")
})
Copy link
Collaborator

@oshoval oshoval Dec 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be done as BeforeAll / BeforeSuite with a defer to cleanup it instead of the AfterEach
On the other hand, it guarantee the leftovers are cleaned if any, but implicit

we usually don't delete the NS after each test

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have only one test, and in the future will maybe have few test. I find this approach cleaner and safer.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is an overkill imo, anyhow we can refactor it later, but imo we should

Expect(err).ToNot(HaveOccurred(), "Should successfully create the NAD")

By("Creating a VirtualMachineInstance")
interfaceName := "nic1"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use a const for it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

interfaces := []v1.Interface{{Name: interfaceName, InterfaceBindingMethod: v1.InterfaceBindingMethod{Bridge: &v1.InterfaceBridge{}}}}
networks := []v1.Network{
{Name: interfaceName, NetworkSource: v1.NetworkSource{
Multus: &v1.MultusNetwork{NetworkName: "ptp-conf"},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use a const for it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? It is never reused.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is nicer to have a const even for one time variable which declares a global name

Multus: &v1.MultusNetwork{NetworkName: "ptp-conf"},
}},
}
vmi := CreateVmiObject("vmi-sec", testNamespace, interfaces, networks)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use a const for it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? It is never reused.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is nicer to have a const even for one time variable which declares a global name

@oshoval
Copy link
Collaborator

oshoval commented Dec 5, 2022

We need to remove push or pull_request from the git actions
when you create a PR it runs both, maybe because you are the original repo creator or something
(it doesn't happen when PRs are created by other people)

Domain: v1.DomainSpec{
Resources: v1.ResourceRequirements{
Requests: k8sv1.ResourceList{
k8sv1.ResourceMemory: resource.MustParse("64M"),
Copy link
Collaborator

@oshoval oshoval Dec 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use 128Mi
64M is not enough
see please kubevirt/kubevirt#5039
especially cirros-dev/cirros#52 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

hack/functest.sh Outdated
source ./cluster/cluster.sh

export KUBEVIRT_CLIENT_GO_SCHEME_REGISTRATION_VERSION=v1
KUBECONFIG=${KUBECONFIG:-$(cluster::kubeconfig)} $GO test -test.timeout=1h -race -test.v ./tests/... $E2E_TEST_ARGS -ginkgo.v
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add deterministic seed of 0 (unless we do want tests to run on random order once we have more)
on kubevirt we use fixed seed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently we have just one test, so it is not relevant.
Anyway, I think it is healthier to run the tests in a random order.

@AlonaKaplan
Copy link
Member Author

[ "$CI" == "true" ] && dnf install bind-utils (*)

if ! nslookup www.google.com > /dev/null 2>&1; then
  echo error
  exit 1
fi

Thanks, updated the PR

@AlonaKaplan AlonaKaplan changed the title First e2e test e2e, Introduce e2e test: resolving a FQDN entry Dec 5, 2022
@oshoval
Copy link
Collaborator

oshoval commented Dec 5, 2022

/release-note-none

@kubevirt-bot kubevirt-bot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Dec 5, 2022
@AlonaKaplan AlonaKaplan force-pushed the firt_e2e branch 2 times, most recently from f9a6b1f to 7b3fa53 Compare December 5, 2022 09:07
@oshoval
Copy link
Collaborator

oshoval commented Dec 5, 2022

Need to show this to Brian please
https://prow.ci.kubevirt.io/view/gs/kubevirt-prow/pr-logs/pull/kubevirt_kubesecondarydns/38/pull-kubesecondarydns-e2e-k8s/1599692018617946112

I think there is a new image with extended timeout
will try to update job to v20221119-67aebd9

kubevirt/project-infra#2500

@oshoval
Copy link
Collaborator

oshoval commented Dec 5, 2022

/test pull-kubesecondarydns-e2e-k8s

i hope btw sudo is not needed, lets see

hack/functest.sh Outdated
echo hello world
source ./cluster/cluster.sh

[ "$CI" == "true" ] && dnf install bind-utils
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-y

Copy link
Collaborator

@oshoval oshoval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need pkg/controllers/controllers_suite_test.go
or it can be deleted ?

tests/client.go Outdated Show resolved Hide resolved
@oshoval
Copy link
Collaborator

oshoval commented Dec 5, 2022

Please fork the repo for next PRs, it seems you are using the main repo branches
https://github.com/kubevirt/kubesecondarydns/branches
This is why it runs both pull_request and push git actions.

exit 1
fi

KUBECONFIG=${KUBECONFIG:-$(cluster::kubeconfig)} $GO test -test.timeout=1h -test.v ./tests/... -ginkgo.v
Copy link
Collaborator

@oshoval oshoval Dec 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we need to add no-color please
else we see the control characters on the log

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

watch the raw one
https://storage.googleapis.com/kubevirt-prow/pr-logs/pull/kubevirt_kubesecondarydns/38/pull-kubesecondarydns-e2e-k8s/1599451475841388544/build-log.txt

well it will remove colors from the spyglass one (the one in the link you pasted)
IIRC this what we are doing on other repos, --no-color (but best to double check)


  �[38;5;243mBegin Captured GinkgoWriter Output >>�[0m
    �[1mSTEP:�[0m Creating test namespace �[38;5;243m12/04/22 17:18:33.833�[0m
    �[1mSTEP:�[0m Creating a NetworkAttachmentDefinition �[38;5;243m12/04/22 17:18:34.402�[0m
    �[1mSTEP:�[0m Creating a VirtualMachineInstance �[38;5;243m12/04/22 17:18:34.409�[0m
    �[1mSTEP:�[0m Invoking nslookup on the VMI interface FQDN �[38;5;243m12/04/22 17:18:34.437�[0m
    �[1mSTEP:�[0m Removing all Virtual Machine Instances from the namespace �[38;5;243m12/04/22 17:19:44.468�[0m
    �[1mSTEP:�[0m Removing all Network AttachmentDefinitions from the namespace �[38;5;243m12/04/22 17:19:54.501�[0m
    �[1mSTEP:�[0m Removing the test namespace �[38;5;243m12/04/22 17:19:54.509�[0m
  �[38;5;243m<< End Captured GinkgoWriter Output�[0m

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have the no-color flag in kubevirt. And I find it nice to see the colors. I prefer to keep it.

Copy link
Collaborator

@oshoval oshoval Dec 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

automation/test.sh:ginko_params="--no-color --seed=42"
automation/repeated_test.sh: ginko_params="-no-color -succinct -slow-spec-threshold=30s -focus=${NEW_TESTS} -skip=QUARANTINE -regexScansFilePath=true"

from kubevirt

Moreover spyglass itself mark the important words like FAIL/FATAL/ERROR and so on IIRC

const testNamespace = "secondary-test"
const dnsPort = "31111"
const dnsIP = "127.0.0.1" // Forwarded to the node port - https://github.com/kubevirt/kubevirtci/pull/867 ,https://github.com/kubevirt/kubesecondarydns/pull/23
const domain = "vm.secondary.io"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about reading it from the CR and building accordingly the expected string?
this way it will work for:

  • empty string
  • D/S that fill the cluster-name (if this what we are going to do at the end)
  • non empty string

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is an overkill for the test. If we will ever need it on d/s, then we can change it.

Copy link
Collaborator

@oshoval oshoval Dec 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this test might even help us to test it D/S manually
but ok we can just update upon need,
what about reading it from os.getenv that allows to config it easily when running D/S ?

EDIT - better to wait indeed, because it is not the only thing that will need to be changed
i.e IP:port

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's think about it when we will get to d/s

@AlonaKaplan AlonaKaplan force-pushed the firt_e2e branch 2 times, most recently from dfb63de to e8429af Compare December 5, 2022 12:43
@AlonaKaplan
Copy link
Member Author

do we still need pkg/controllers/controllers_suite_test.go or it can be deleted ?

We need it. It is for the controller unit tests.

@oshoval
Copy link
Collaborator

oshoval commented Dec 5, 2022

Please note this test would run also as part of CNAO
CNAO deploys KSD and calls make create-nodeport, and then vendor the repo and run the make functest target.
so if there is something that related to kubeconfig / namespace etc
it should be dynamic (about kubeconfig saw you already took care)

@AlonaKaplan
Copy link
Member Author

I use test namespace. It should be ok.

@oshoval
Copy link
Collaborator

oshoval commented Dec 6, 2022

Once kubevirt/project-infra#2504 is merged we can remove the dnf install line please

Copy link
Collaborator

@oshoval oshoval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, few more small comments

about PR desc, nodes reducing - maybe worth to either explain why, or at least tell see (specific) commit for more info

Name: "cloudinitdisk",
DiskDevice: v1.DiskDevice{
Disk: &v1.DiskTarget{
Bus: "virtio",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use virtio in couple places in the same file. worth to add const please

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Comment on lines 46 to 53
vmiList := &v1.VirtualMachineInstanceList{}
err := getClient().List(context.Background(), vmiList, &client.ListOptions{Namespace: testNamespace})
Expect(err).ToNot(HaveOccurred())

for _, vmiObject := range vmiList.Items {
err = getClient().Delete(context.Background(), &vmiObject)
Expect(err).ToNot(HaveOccurred())
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't there a way to just delete in one shot all vms from a given namespace using the client ?
(if so, same for nads etc)

Note that the Expect in the for means that if an error occur, it will skip the rest,
i guess it is fine for now, maybe in the future we would prefer to collect errors but continue and assert the errors at the end

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I'm removing the namespace, remvoing the nads and vmis is redudnant anyway. Removed it.

Copy link
Collaborator

@oshoval oshoval Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its a bit not what we are doing usually, but it does the job
fine for now, later we can update if needed
(note that it does stuff implicit)

err := getClient().List(context.Background(), nadList, &client.ListOptions{Namespace: testNamespace})
Expect(err).ToNot(HaveOccurred())

for _, nadObject := range nadList.Items {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have just one nad, can we simplify this AfterEach please ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

err := getClient().List(context.Background(), vmiList, &client.ListOptions{Namespace: testNamespace})
Expect(err).ToNot(HaveOccurred())
return len(vmiList.Items)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please drop this blank line
(same for line 80)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

vmiList := &v1.VirtualMachineInstanceList{}
err := getClient().List(context.Background(), vmiList, &client.ListOptions{Namespace: testNamespace})
Expect(err).ToNot(HaveOccurred())
return len(vmiList.Items)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe return vmiList.Items and use BeEmpty ?
(same for the rest)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was removed

Comment on lines 89 to 53
Eventually(func() error {
return getClient().Delete(context.Background(), namespace)
}, 240*time.Second, 1*time.Second).Should(SatisfyAll(HaveOccurred(), WithTransform(errors.IsNotFound, BeTrue())), fmt.Sprintf("should successfully delete namespace '%s'", testNamespace))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better and nicer please to delete once, and wait that get shows it is gone, as done with the rest
not delete in a loop as done now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is more compact this way. What are the benefits of the proposed approach?

Copy link
Collaborator

@oshoval oshoval Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't correct to Delete Delete .. until gone
it is correct to Delete, Get Get until gone imo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Comment on lines +96 to +63
By("Creating a NetworkAttachmentDefinition")
err := createNetworkAttachmentDefinition(testNamespace, "ptp-conf")
Expect(err).ToNot(HaveOccurred(), "Should successfully create the NAD")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be done please as a BeforeEach of this It (in the same Context), as it is not part of the "It" but preparation,
makes the It smaller

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

func CreateVmiObject(name string, namespace string, interfaces []v1.Interface, networks []v1.Network) *v1.VirtualMachineInstance {
vmi := getBaseVMI(randName(name))
vmi.Namespace = namespace
addContainerDisk(&vmi.Spec, "kubevirt/cirros-container-disk-demo:latest")
Copy link
Collaborator

@oshoval oshoval Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need maybe to add quay.io ? so it won't take from docker.io which we might stop updating ?

Note that the quay.io one is very old (2 years), the new ones have tag and are pretty newer (the "latest" might be an old os version that we don't use anymore)
I am not sure about what the docker.io has
we might want to consider later to upload a specific image or select a specific tag / specific image repo (such as quay.io)
pinning is also better than using latest.
anyhow we can postpone it if desired

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add it to our local registry.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still you need to select which one - this is the important part.
and imo no need to add it to the local, as it you are fetching it anyhow
but whatever you prefer

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to quay.io/kubevirt/cirros-container-disk-demo:develalthough it doesn't really matter what image we are using. The devel one is maintained by kubevirt is should be enough for us.

hack/functest.sh Outdated
echo hello world
source ./cluster/cluster.sh

[ "$CI" == "true" ] && dnf install -y bind-utils
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this line as kubevirt/project-infra#2504 is merged and includes
bind-utils

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@AlonaKaplan
Copy link
Member Author

Thanks, few more small comments

about PR desc, nodes reducing - maybe worth to either explain why, or at least tell see (specific) commit for more info

The relevant commit message has an explanation. Do you think it is not enough?

@oshoval
Copy link
Collaborator

oshoval commented Dec 6, 2022

Thanks, few more small comments
about PR desc, nodes reducing - maybe worth to either explain why, or at least tell see (specific) commit for more info

The relevant commit message has an explanation. Do you think it is not enough?

It is enough, but the line of the PR desc better to suggest to look on it please
Changing the number of nodes in the ci cluster to 1 (it is enough for now).
to
Changing the number of nodes of the cluster to 1 (see 2nd commit).

You might want to amend the 2nd commit by adding that the reason the NodePort doesn't work on the first node, is that in case there are more than 1 nodes, that node is not a worker and only workers are included as you found.
Alternatively also to add this info to the PR desc itself.


const timeout = 3 * time.Minute
const pollingInterval = 5 * time.Second
const testNamespacePrefix = "secondary-test"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we need this with the random suffix ?
even if we run on parallel, there will be a namespace per instance as kubevirt is doing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently we have just one test so we can use whatever namespace.
In the future, if we have more than one test we can continue to the next test without waiting for the previous test resources to be removed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not a good practice imo, and i less like the way using different namespaces
I prefer that we delete VMI and not wait for them but not delete the NS as we are doing on kubevirt
note that on kubevirt there are some places where we do wait for all resources to gone

v1 "kubevirt.io/api/core/v1"
)

const virtio = "virtio"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: const VirtIO
(this is like we are doing it on kubevirt)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

var testNamespace string

var _ = Describe("Virtual Machines Startup", func() {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please drop the blank line

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Signed-off-by: Alona Paz <alkaplan@redhat.com>
The script also makes sure `nslookup` is installed.

Signed-off-by: Alona Paz <alkaplan@redhat.com>
Copy link
Collaborator

@oshoval oshoval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Dec 6, 2022
@AlonaKaplan
Copy link
Member Author

/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AlonaKaplan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 6, 2022
@kubevirt-bot kubevirt-bot merged commit 812cfcf into main Dec 6, 2022
@AlonaKaplan AlonaKaplan deleted the firt_e2e branch December 6, 2022 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants