Skip to content

Commit

Permalink
Merge pull request rancher#44112 from igomez06/v2.7-shepherd-update
Browse files Browse the repository at this point in the history
[v2.7] Updated Rancher to import the framework from the repo rancher/shepherd.
  • Loading branch information
Israel Gomez authored Feb 1, 2024
2 parents 84228de + b4acb33 commit de52cc0
Show file tree
Hide file tree
Showing 775 changed files with 615 additions and 38,985 deletions.
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ require (
require (
github.com/antihax/optional v1.0.0
github.com/containers/image/v5 v5.25.0
github.com/rancher/shepherd v0.0.0-20240130172559-0b66a23953f2
go.qase.io/client v0.0.0-20231114201952-65195ec001fa
)

Expand Down Expand Up @@ -339,7 +340,7 @@ require (
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
github.com/opencontainers/runc v1.1.6 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/sftp v1.13.5
github.com/pkg/sftp v1.13.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
Expand All @@ -352,7 +353,7 @@ require (
github.com/shopspring/decimal v1.2.0 // indirect
github.com/smartystreets/goconvey v1.7.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.7.0
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,8 @@ github.com/rancher/remotedialer v0.2.6-0.20220624190122-ea57207bf2b8 h1:leqh0chj
github.com/rancher/remotedialer v0.2.6-0.20220624190122-ea57207bf2b8/go.mod h1:BwwztuvViX2JrLLUwDlsYt5DiyUwHLlzynRwkZLAY0Q=
github.com/rancher/rke v1.4.10 h1:JP3j9mPjPojopN73Qwu5efKw9PQ7od+GKrHpVJLW3fg=
github.com/rancher/rke v1.4.10/go.mod h1:zCL+we25sFDQb2jo6EojX8zxBfbB7FxL6Lte6A6eCiY=
github.com/rancher/shepherd v0.0.0-20240130172559-0b66a23953f2 h1:dIhaNNzN32qrKfhCwPs8L5lTWy2NTy3xzSDcMzccxYU=
github.com/rancher/shepherd v0.0.0-20240130172559-0b66a23953f2/go.mod h1:544XWejV/CYcv5NL+NztxJHL2FnZzMqcaz6tdUd/VOs=
github.com/rancher/steve v0.0.0-20230717160251-d040cffef385 h1:xMR4LJY5C4LAkJbmVKYvu4BaCYXx2fu99a0K+gErpA0=
github.com/rancher/steve v0.0.0-20230717160251-d040cffef385/go.mod h1:lCxhhsajJHMUnj0EU+3mbrucc6mHDYD94abDiWX6I/Y=
github.com/rancher/system-upgrade-controller/pkg/apis v0.0.0-20210727200656-10b094e30007 h1:ru+mqGnxMmKeU0Q3XIDxkARvInDIqT1hH2amTcsjxI4=
Expand Down
22 changes: 3 additions & 19 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Rancher Test Framework provides tools for writing integrations and validatio
To run rancher integration tests you will need:
- a running instance of rancher with an accessible url
- a rancher access token for the admin user
- [golang 1.17](https://go.dev/doc/install)
- [golang 1.19](https://go.dev/doc/install)
- [k3d](https://k3d.io/v5.1.0/)

#### Validation
Expand All @@ -26,25 +26,9 @@ Integration tests - Don't require any external configuration or access to any ot

Validation tests - Require access to external services, and needs to a config file to run them.

### Extensions
## Framework

Extensions are functions that complete common operations used by tests. Extensions should not require much configuration or support multiple behaviors. Extensions should be simple enough that they can be used in many tests without needing to be tested themselves.

### Clients

Clients are used to create the resources in the tests. The advantage of the cients is they register the cleanups with sessions, making resource cleanup trivial. There are three clients; the rancher client, dynamic client, and the k3d client. The rancher client is used to create resources on a rancher instance. Given a host url, and a bearer token the rancher client communicates directly with the rancher instance. The dynamic client is used as means of communication on a downstream cluster, and used for kubernete resource management on that cluster. The k3d client is used to create a minimal k3d cluster, this is to give the integration tests the ability to test against a downstream cluster.

### Wait

Wait is used to monitor resources, and wait for specified conditions. There are multiple ways to wait for a resource. There is WatchWait that uses the watch.Interface of a resource to wait until the check function returns true. For more generic polling or waiting, the "k8s.io/apimachinery/pkg/util/wait" package can be used.

### Sessions

Sessions are used to track resources created by tests. A session allows cleanup functions to be registered while it is open. Once a session is closed the cleanup functions will be called latest to oldest. Sessions should be closed after a set of tests that use the same resources is completed. This eliminates the need for each test to create and tear down its own resources allowing for more efficient reuse of some resources. When pared with a client sessions are a powerful tool that can track and cleanup any resource a tests creates with no additional work from the developer.

### Configuration

Configuration is loaded from the yaml or json file described in `CATTLE_TEST_CONFIG`. Configuration objects are loaded from their associated key in the configuration file. Default values can also be set on configuration objects.
Shepherd is our testing framework and is located https://github.com/rancher/shepherd. For more info please visit the repo.


## How to Write Tests
Expand Down
40 changes: 0 additions & 40 deletions tests/framework/clients/corral/config.go

This file was deleted.

219 changes: 0 additions & 219 deletions tests/framework/clients/corral/corral.go

This file was deleted.

Loading

0 comments on commit de52cc0

Please sign in to comment.