-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1527 from Nordix/mquhuy/e2e-parallel-test
🌱 Enable parallel testing in E2E
- Loading branch information
Showing
22 changed files
with
252 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# This script reads BMC information in a config file and prepare VMs | ||
# whose info match those config | ||
# | ||
set -eux | ||
|
||
REPO_ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")/..") | ||
cd "${REPO_ROOT}" | ||
|
||
CONFIG_FILE=$1 | ||
NETWORK=${2:-"baremetal-e2e"} | ||
|
||
readarray -t BMCS < <(yq e -o=j -I=0 '.[]' "${CONFIG_FILE}") | ||
|
||
for bmc in "${BMCS[@]}"; do | ||
address=$(echo "${bmc}" | jq -r '.address') | ||
bootMacAddress=$(echo "${bmc}" | jq -r '.bootMacAddress') | ||
hostName=$(echo "${bmc}" | jq -r '.hostName') | ||
ipAddress=$(echo "${bmc}" | jq -r '.ipAddress') | ||
|
||
# Add the the VM to the network host list | ||
virsh -c qemu:///system net-update "${NETWORK}" add-last ip-dhcp-host \ | ||
"<host mac='${bootMacAddress}' name='${hostName}' ip='${ipAddress}' />" \ | ||
--live --config --parent-index 0 | ||
|
||
# Create VM | ||
"${REPO_ROOT}/tools/bmh_test/create_vm.sh" "${hostName}" "${bootMacAddress}" | ||
|
||
# Add BMH VM to VBMC | ||
if [[ "${address}" =~ "ipmi://" ]]; then | ||
vbmc_port="${address##*:}" | ||
"${REPO_ROOT}/tools/bmh_test/vm2vbmc.sh" "${hostName}" "${vbmc_port}" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eux | ||
|
||
USR_LOCAL_BIN="/usr/local/bin" | ||
YQ_VERSION="v4.40.5" | ||
|
||
# Check if yq tool is installed and install it if not | ||
verify_yq() | ||
{ | ||
if ! [[ -x "$(command -v yq)" ]]; then | ||
if [[ "${OSTYPE}" == "linux-gnu" ]]; then | ||
echo "yq not found, installing" | ||
curl -LO "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64.tar.gz" | ||
tar xvf yq_linux_amd64.tar.gz | ||
sudo install yq_linux_amd64 "${USR_LOCAL_BIN}/yq" | ||
else | ||
echo "Missing required binary in path: yq" | ||
return 2 | ||
fi | ||
fi | ||
} | ||
|
||
verify_yq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package e2e | ||
|
||
import ( | ||
"os" | ||
|
||
. "github.com/onsi/gomega" | ||
"gopkg.in/yaml.v2" | ||
) | ||
|
||
// BMC defines a BMH to use in the tests | ||
type BMC struct { | ||
// BMC initial username | ||
User string `yaml:"user,omitempty"` | ||
// BMC initial password | ||
Password string `yaml:"password,omitempty"` | ||
// BMC initial address | ||
Address string `yaml:"address,omitempty"` | ||
// BMC Mac address | ||
BootMacAddress string `yaml:"bootMacAddress,omitempty"` | ||
// The Hostname of the node, which will be read into BMH object | ||
HostName string `yaml:"hostName,omitempty"` | ||
// The IP address of the node | ||
// Optional. Only needed if e2eConfig variable | ||
// SSH_CHECK_PROVISIONED is true | ||
IpAddress string `yaml:"ipAddress,omitempty"` | ||
// Optional. Only needed if e2eConfig variable | ||
// SSH_CHECK_PROVISIONED is true | ||
SSHPort string `yaml:"sshPort,omitempty"` | ||
} | ||
|
||
func LoadBMCConfig(configPath string) *[]BMC { | ||
configData, err := os.ReadFile(configPath) //#nosec | ||
Expect(err).ToNot(HaveOccurred(), "Failed to read the bmcs config file") | ||
var bmcs []BMC | ||
Expect(yaml.Unmarshal(configData, &bmcs)).To(Succeed()) | ||
return &bmcs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# For fixture config, only the `hostName` field matters. The number of BMCs, | ||
# however, needs to be equal or larger than `GINKGO_NODES`. | ||
- user: admin | ||
password: password | ||
address: "redfish+http://192.168.222.1:8000/redfish/v1/Systems/bmo-e2e-0" | ||
bootMacAddress: "00:60:2f:31:81:01" | ||
hostName: "" | ||
ipAddress: "192.168.222.122" | ||
sshPort: "22" | ||
- user: admin | ||
password: password | ||
address: "redfish+http://192.168.222.1:8000/redfish/v1/Systems/bmo-e2e-1" | ||
bootMacAddress: "00:60:2f:31:81:02" | ||
hostName: "" | ||
ipAddress: "192.168.222.123" | ||
sshPort: "22" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
- user: admin | ||
password: password | ||
address: "redfish+http://192.168.222.1:8000/redfish/v1/Systems/bmo-e2e-0" | ||
bootMacAddress: "00:60:2f:31:81:01" | ||
hostName: "bmo-e2e-0" | ||
ipAddress: "192.168.222.122" | ||
sshPort: "22" | ||
- user: admin | ||
password: password | ||
address: "redfish+http://192.168.222.1:8000/redfish/v1/Systems/bmo-e2e-1" | ||
bootMacAddress: "00:60:2f:31:81:02" | ||
hostName: "bmo-e2e-1" | ||
ipAddress: "192.168.222.123" | ||
sshPort: "22" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
- user: admin | ||
password: password | ||
address: "ipmi://192.168.222.1:16230" | ||
bootMacAddress: "00:60:2f:31:81:01" | ||
hostName: "bmo-e2e-0" | ||
ipAddress: "192.168.222.122" | ||
sshPort: "22" | ||
- user: admin | ||
password: password | ||
address: "ipmi://192.168.222.1:16231" | ||
bootMacAddress: "00:60:2f:31:81:02" | ||
hostName: "bmo-e2e-1" | ||
ipAddress: "192.168.222.123" | ||
sshPort: "22" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.