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

Adding in deploy changes tests for vcluster #2051

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sowmyav27
Copy link

@sowmyav27 sowmyav27 commented Aug 8, 2024

What issue type does this pull request address? (keep at least one, remove the others)
Tests -- Adding in deploy changes tests for vcluster

  • networkPolicy, limitRange and resourceQuota
  • sync - toHost - serviceaccount and pod

Copy link

netlify bot commented Aug 8, 2024

Deploy Preview for vcluster-docs canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit 5190f8d
🔍 Latest deploy log https://app.netlify.com/sites/vcluster-docs/deploys/66cdf13a1377c10007f4cbfa

@sowmyav27 sowmyav27 marked this pull request as draft August 8, 2024 21:41
@sowmyav27 sowmyav27 force-pushed the deploy-changes branch 28 times, most recently from 8fe8bc5 to 0cc2efa Compare August 12, 2024 23:58
@sowmyav27 sowmyav27 force-pushed the deploy-changes branch 21 times, most recently from d657a9e to ece351f Compare August 27, 2024 14:35
@sowmyav27 sowmyav27 marked this pull request as ready for review August 27, 2024 14:36
- main
- v*
paths:
- "test/deploy_changes/**"
Copy link
Contributor

Choose a reason for hiding this comment

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

This means we only want to run these tests if a file in test/deploy_changes/ changes. I believe we want this to run more often than that or else its not testing functional code changes for vcluster.

deployCmd.Stdout = stdout
err := deployCmd.Run()
framework.ExpectNoError(err)
return err == nil && strings.Contains(stdout.String(), "Switched active kube context to")
Copy link
Contributor

Choose a reason for hiding this comment

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

Would an error be normal here, if so which error? We don't want to poll on an error if its not going to change.

checkCmd := exec.Command("vcluster", "list")
output, err := checkCmd.CombinedOutput()
framework.ExpectNoError(err)
return err == nil && strings.Contains(string(output), f.VclusterName) && strings.Contains(string(output), "Running")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this check is too general. Here is the output of my vcluster list:

      NAME    |        NAMESPACE         | STATUS  |    VERSION     | CONNECTED |    AGE     
  ------------+--------------------------+---------+----------------+-----------+------------
    vcluster2 | loft-default-v-vcluster2 | Running | 0.20.0-beta.15 |           | 266h4m40s  
    vcluster  | vcluster                 | Running | uLmOpUH        |           | 238h42m5s  

Let's say instead vcluster2 was not in Running and f.VclusterName was vcluster2. The output still contains vcluster2 and Running. I think instead you may want to split by new line or, even better use a regex. I still would be worried about using contains with the former because you have to consider on a single line that f.VclusterName could be a substring of another vcluster name, like with vcluster and vcluster2.

to: default/nginx
experimental:
syncSettings:
setOwner: true
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add newline

)

var _ = ginkgo.Describe("Deploy sync changes to vCluster", func() {
ginkgo.It("should deploy a vCluster using kubectl and verify sync changes ", func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This says deploy a vCluster but it seems there is one already deployed. Redeploy or update would be more accurate.

Copy link
Member

@FabianKramm FabianKramm left a comment

Choose a reason for hiding this comment

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

This is a pretty big change as that moves all tests to a different folder and I'm not sure this is what we want as e2e tests are pretty hidden now. I would like to eventually have a consistent naming across vcluster, vcluster-pro and loft-enterprise. Whats the reasoning behind moving them to functional_tests? I find the naming a little odd as we have now test -> functional_tests and test -> deploy_changes, which seems a little inconsistent to me, as one has tests in it and the other not. When looking at Kubernetes, they also do test -> e2e, so I would like to stay with that pattern, but we could introduce test -> deploy or something similar for your new tests

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 this pull request may close these issues.

3 participants