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

Basic E2E test, utils implementation and scripts to setup KinD cluster #196

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

MichalGuzieniuk
Copy link
Contributor

@MichalGuzieniuk MichalGuzieniuk commented Sep 16, 2021

This pull requests brings

  • E2E tests - set of basic tests that are focused on all features of SRIOV-CNI. It is a kind of smoke tests.
  • KinD cluster setup scripts - actually those scripts are quite similar to the one which we have for Network Resources Injector
  • Utils - that allows to create / manage objects in our cluster - this part takes about half of this commit.

Thus, the main purpose of this pull request is to provide an environment for tests. In following PRs a specific tests for each part of SRIOV-CNI functionality can be delivered.

Within PR you may also find a Github workflow that aims to run tests on self hosted runner. Currently this workflow is disable because there is no server with hardware connected to this repository. Once it is done, such workflow can be enabled.

In current state, scripts in this change can help to verify changes offline in the lab where hardware is available. For details how to pass information about network interface that should be used in tests please check test\Readme.

@MichalGuzieniuk
Copy link
Contributor Author

I looked into issue with CI, and this is something that does not happens when I call make test locally, because folder github.com/k8snetworkplumbingwg/sriov-cni/test/e2e was excluded from test on Makefile level. Need to check how github actions are triggering the build.

@Eoghan1232
Copy link
Collaborator

@zshi-redhat @adrianchiris could you review?

@Eoghan1232
Copy link
Collaborator

@adrianchiris @zshi-redhat Can we kick this off again? :)

@zshi-redhat
Copy link
Collaborator

/cc @wizhaoredhat

scripts/e2e_get_tools.sh Outdated Show resolved Hide resolved
@zeeke
Copy link
Member

zeeke commented Mar 24, 2022

@MichalGuzieniuk great job! I think it would be great to have E2E tests in this project.

However, I'm having trouble while running the preparation script scripts/e2e_setup_cluster.sh:

+ status=0
+ timeout 300 bash -c 'echo kubectl create -f https://raw.githubusercontent.com/k8snetworkplumbingwg/multus-cni/master/images/multus-daemonset.yml && kubectl create -f https://raw.githubusercontent.com/k8snetworkplumbingwg/multus-cni/master/images/multus-daemonset.yml'
kubectl create -f https://raw.githubusercontent.com/k8snetworkplumbingwg/multus-cni/master/images/multus-daemonset.yml
error: unable to read URL "https://raw.githubusercontent.com/k8snetworkplumbingwg/multus-cni/master/images/multus-daemonset.yml", server reported 404 Not Found, status code=404
+ status=1
+ '[' 1 -eq 0 ']'
+ echo 'Exit code: '\''1'\''. Sleeping '\''10'\'' seconds before retrying'

Maybe we can point to the new multus DaemonSet manifest?

@Eoghan1232
Copy link
Collaborator

Done. updated URL.

I am taking over this PR as Michal has moved on.

@MichalGuzieniuk
Copy link
Contributor Author

Done. updated URL.

I am taking over this PR as Michal has moved on.

Thank you.

scripts/e2e_setup_cluster.sh Outdated Show resolved Hide resolved
test/util/net/netlink.go Outdated Show resolved Hide resolved
test/util/images/images.go Outdated Show resolved Hide resolved
@Eoghan1232
Copy link
Collaborator

/retest

1 similar comment
@Eoghan1232
Copy link
Collaborator

/retest

@zeeke
Copy link
Member

zeeke commented Mar 30, 2022

lgtm

@Eoghan1232
Copy link
Collaborator

@zshi-redhat
@adrianchiris

WDYT? Ready to merge?

Copy link
Contributor

@adrianchiris adrianchiris left a comment

Choose a reason for hiding this comment

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

Overall code seems OK.

Been trying to run this on a Mellanox NIC but without success.
all 3 tests fail with the same error:

___________________________________ START TEST WITH enp3s0f0 ___________________________________________                                                                     
________________________________________________________________________________________________________                                                                     
Tests are going to be run with PF enp3s0f0 interfaces within KinD network namespace: /var/run/docker/netns/cc02027f2eff on driver: kernel                                    
Device Plugin configuration read from /usr/share/e2e/enp3s0f0-dp-config.json                                                                                                 
=== RUN   TestSriovTests                                                                                                                                                     
Running Suite: SR-IOV CNI E2E suite                                                                                                                                          
===================================                                                                                                                                          
Random Seed: 1650813914                                                                                                                                                      
Will run 3 of 3 specs                                                                                                                                                        
                                                                                                                                                                             
STEP: Store host links before tests                                                                                                                                          
STEP: Create network attachment definition                                                                                                                                   
STEP: Create POD                                                                                                                                                             
STEP: Delete network attachment definition                                                                                                                                   
STEP: Get links after test and move those which were moved from Docker to host, once again to Docker netNs                                                                   
_ Failure [30.094 seconds]                                                                                                                                                   
SR-IOV CNI test                                                                                                                                                              
/tmp/sriov-cni/test/e2e/sriov_smoke_test.go:18                                                                                                                               
  Test with kernel Virtual Function driver                                                                                                                                   
  /tmp/sriov-cni/test/e2e/sriov_smoke_test.go:19                                                                                                                             
    POD is able to consume SR-IOV interfaces                                                                                                                                 
    /tmp/sriov-cni/test/e2e/sriov_smoke_test.go:48                                                                                                                           
      Second interface is available within POD [It]                                                                                                                          
      /tmp/sriov-cni/test/e2e/sriov_smoke_test.go:49                                                                                                                         
                                                                                                                                                                             
      Expected                                                                                                                                                               
          <*errors.errorString | 0xc000290580>: {                                                                                                                            
              s: "timed out waiting for the condition",                                                                                                                      
          }                                                                                                                                                                  
      to be nil                                                                                                                                                              
                                                                                                                                                                             
      /tmp/sriov-cni/test/e2e/sriov_smoke_test.go:56                                                                                                                         
------------------------------                                                                                                                                               

I have added mlx5_core driver to: supportedKenrelDrivers in e2e_test_suite_test.go

any pointers on how to debug this ?

go.mod Outdated
github.com/vishvananda/netlink v1.0.1-0.20190924205540-07ace697bea4
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.1.0
github.com/k8snetworkplumbingwg/sriov-network-operator v1.0.0
Copy link
Contributor

Choose a reason for hiding this comment

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

i dont think we are actually using this.

also need to run go mod tidy as i see differences when I ran on my machine

test/README.MD Outdated
"selectors": {
"vendors": ["8086"],
"devices": ["154c"],
"driver": ["iavf"]
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: drivers

stdoutString, stderrString, err = pod.ExecuteCommand(cs.CoreV1Interface, kubeConfig, podObj.Name, *testNs, "test", "ethtool -i net1")
Expect(err).Should(BeNil())
Expect(stderrString).Should(Equal(""))
Expect(stdoutString).Should(ContainSubstring("driver: iavf"))
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should check if its in supportedKernelDrivers list from e2e_test_suite_test.go

@Eoghan1232
Copy link
Collaborator

Overall code seems OK.

Been trying to run this on a Mellanox NIC but without success. all 3 tests fail with the same error:

___________________________________ START TEST WITH enp3s0f0 ___________________________________________                                                                     
________________________________________________________________________________________________________                                                                     
Tests are going to be run with PF enp3s0f0 interfaces within KinD network namespace: /var/run/docker/netns/cc02027f2eff on driver: kernel                                    
Device Plugin configuration read from /usr/share/e2e/enp3s0f0-dp-config.json                                                                                                 
=== RUN   TestSriovTests                                                                                                                                                     
Running Suite: SR-IOV CNI E2E suite                                                                                                                                          
===================================                                                                                                                                          
Random Seed: 1650813914                                                                                                                                                      
Will run 3 of 3 specs                                                                                                                                                        
                                                                                                                                                                             
STEP: Store host links before tests                                                                                                                                          
STEP: Create network attachment definition                                                                                                                                   
STEP: Create POD                                                                                                                                                             
STEP: Delete network attachment definition                                                                                                                                   
STEP: Get links after test and move those which were moved from Docker to host, once again to Docker netNs                                                                   
_ Failure [30.094 seconds]                                                                                                                                                   
SR-IOV CNI test                                                                                                                                                              
/tmp/sriov-cni/test/e2e/sriov_smoke_test.go:18                                                                                                                               
  Test with kernel Virtual Function driver                                                                                                                                   
  /tmp/sriov-cni/test/e2e/sriov_smoke_test.go:19                                                                                                                             
    POD is able to consume SR-IOV interfaces                                                                                                                                 
    /tmp/sriov-cni/test/e2e/sriov_smoke_test.go:48                                                                                                                           
      Second interface is available within POD [It]                                                                                                                          
      /tmp/sriov-cni/test/e2e/sriov_smoke_test.go:49                                                                                                                         
                                                                                                                                                                             
      Expected                                                                                                                                                               
          <*errors.errorString | 0xc000290580>: {                                                                                                                            
              s: "timed out waiting for the condition",                                                                                                                      
          }                                                                                                                                                                  
      to be nil                                                                                                                                                              
                                                                                                                                                                             
      /tmp/sriov-cni/test/e2e/sriov_smoke_test.go:56                                                                                                                         
------------------------------                                                                                                                                               

I have added mlx5_core driver to: supportedKenrelDrivers in e2e_test_suite_test.go

any pointers on how to debug this ?

Overall code seems OK.

Been trying to run this on a Mellanox NIC but without success. all 3 tests fail with the same error:

___________________________________ START TEST WITH enp3s0f0 ___________________________________________                                                                     
________________________________________________________________________________________________________                                                                     
Tests are going to be run with PF enp3s0f0 interfaces within KinD network namespace: /var/run/docker/netns/cc02027f2eff on driver: kernel                                    
Device Plugin configuration read from /usr/share/e2e/enp3s0f0-dp-config.json                                                                                                 
=== RUN   TestSriovTests                                                                                                                                                     
Running Suite: SR-IOV CNI E2E suite                                                                                                                                          
===================================                                                                                                                                          
Random Seed: 1650813914                                                                                                                                                      
Will run 3 of 3 specs                                                                                                                                                        
                                                                                                                                                                             
STEP: Store host links before tests                                                                                                                                          
STEP: Create network attachment definition                                                                                                                                   
STEP: Create POD                                                                                                                                                             
STEP: Delete network attachment definition                                                                                                                                   
STEP: Get links after test and move those which were moved from Docker to host, once again to Docker netNs                                                                   
_ Failure [30.094 seconds]                                                                                                                                                   
SR-IOV CNI test                                                                                                                                                              
/tmp/sriov-cni/test/e2e/sriov_smoke_test.go:18                                                                                                                               
  Test with kernel Virtual Function driver                                                                                                                                   
  /tmp/sriov-cni/test/e2e/sriov_smoke_test.go:19                                                                                                                             
    POD is able to consume SR-IOV interfaces                                                                                                                                 
    /tmp/sriov-cni/test/e2e/sriov_smoke_test.go:48                                                                                                                           
      Second interface is available within POD [It]                                                                                                                          
      /tmp/sriov-cni/test/e2e/sriov_smoke_test.go:49                                                                                                                         
                                                                                                                                                                             
      Expected                                                                                                                                                               
          <*errors.errorString | 0xc000290580>: {                                                                                                                            
              s: "timed out waiting for the condition",                                                                                                                      
          }                                                                                                                                                                  
      to be nil                                                                                                                                                              
                                                                                                                                                                             
      /tmp/sriov-cni/test/e2e/sriov_smoke_test.go:56                                                                                                                         
------------------------------                                                                                                                                               

I have added mlx5_core driver to: supportedKenrelDrivers in e2e_test_suite_test.go

any pointers on how to debug this ?

@adrianchiris it looks like for some reason the VF you are trying to use is not passed into the pod.
What you could try: comment line 55 in sriov_smoke_test.go., run the test, login to the kind cluster and describe the pod that fails to see if there's anything meaningful.

@SchSeba
Copy link
Collaborator

SchSeba commented Aug 11, 2022

@Eoghan1232 will it be possible to rebase this PR to fix the merge issues?

@coveralls
Copy link

coveralls commented Aug 11, 2022

Pull Request Test Coverage Report for Build 2839211263

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 36.724%

Totals Coverage Status
Change from base Build 2732265896: 0.0%
Covered Lines: 213
Relevant Lines: 580

💛 - Coveralls

@Eoghan1232
Copy link
Collaborator

Eoghan1232 commented Aug 11, 2022

@Eoghan1232 will it be possible to rebase this PR to fix the merge issues?

@SchSeba Done. Lint seems to be failing, but not an error due to PR.

test/README.MD Outdated

### How to test e2e

To be able to execute Go tests it is necessary to create configuration files that will provide information about interface to be used in tests and configuration of device plugin. Based on that information scripts will execute tests. It is in responsibility of vendor that provides host to create those configuration files and prepare network interfaces with correct driver and sufficient number of Virtual Functions (VF). Test suite will NOT create any VFs on its own. After KinD initialization each VFs driver is checked against supported drivers array. It is not allowed to mix kernel space drivers with user space drivers on one Physical Function (PF). Vendors can update the driver array if needed by providing pull request with change. The array is defined inside **sriov-cni/test/e2e/e2e_tests_suite_test.go**. Test suite based on configuration tries to automatically detect the driver space and run tests suitable only for those drivers.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: sriov-cni/test/e2e/e2e_test_suite_test.go

RETRY_MAX=10
INTERVAL=10
TIMEOUT=300
MULTUS_DAEMONSET_URL="https://raw.githubusercontent.com/k8snetworkplumbingwg/multus-cni/master/images/multus-daemonset.yml"
Copy link
Contributor

Choose a reason for hiding this comment

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

URL is returing for 404, multus-daemonset.yml is deployments folder.
MULTUS_DAEMONSET_URL="https://raw.githubusercontent.com/k8snetworkplumbingwg/multus-cni/master/deployments/multus-daemonset.yml"

test/README.MD Outdated
### How to teardown cluster

```
$ ./scripts/e2e_teardown.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: ./scripts/e2e_teardown_cluster.sh

@SchSeba
Copy link
Collaborator

SchSeba commented Dec 21, 2023

can we close this one in favor of #282?

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.

8 participants