Skip to content

Commit

Permalink
Merge pull request #2406 from reubenmiller/update-install-tests
Browse files Browse the repository at this point in the history
tests: update tests after latest 0.13.0 release
  • Loading branch information
reubenmiller authored Nov 3, 2023
2 parents 49146ba + 5cf4b1a commit c4c8a55
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 31 deletions.
2 changes: 1 addition & 1 deletion crates/common/download/examples/simple_download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use download::Downloader;
async fn main() -> Result<()> {
// Create Download metadata.
let url_data = DownloadInfo::new(
"https://raw.githubusercontent.com/thin-edge/thin-edge.io/main/get-thin-edge_io.sh",
"https://raw.githubusercontent.com/thin-edge/thin-edge.io/main/README.md",
);

// Create downloader instance with desired file path and target directory.
Expand Down
2 changes: 1 addition & 1 deletion crates/common/download/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
//! async fn main() -> Result<()> {
//! // Create Download metadata.
//! let url_data = DownloadInfo::new(
//! "https://raw.githubusercontent.com/thin-edge/thin-edge.io/main/get-thin-edge_io.sh",
//! "https://raw.githubusercontent.com/thin-edge/thin-edge.io/main/README.md",
//! );
//!
//! // Create downloader instance with desired file path and target directory.
Expand Down
2 changes: 1 addition & 1 deletion tests/RobotFramework/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ If you are looking to use packages that you locally built, then just use `invoke

**What is happening?**

When building the docker image it will automatically add all the files/folders under the `tests/images/deb` path to the built image. These files are then used by the test bootstrapping script (`bootstrap.sh`) which is also part of the docker image. The bootstrapping process is smart enough to detect if there are debian packages there, and if will install the tedge related packages. If no packages are found then it will revert to installing the latest official tedge version via the `get-thin-edge_io.sh` script.
When building the docker image it will automatically add all the files/folders under the `tests/images/deb` path to the built image. These files are then used by the test bootstrapping script (`bootstrap.sh`) which is also part of the docker image. The bootstrapping process is smart enough to detect if there are debian packages there, and if will install the tedge related packages. If no packages are found then it will revert to installing the latest official tedge version via the `https://thin-edge.io/install.sh` script.

## Viewing the test reports and logs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ Clear previous downloaded files if any
Execute Command rm -f *.deb; rm -f uninstall-thin-edge_io.sh

Install thin-edge.io
Execute Command curl -fsSL https://raw.githubusercontent.com/thin-edge/thin-edge.io/main/get-thin-edge_io.sh | sudo sh -s
Execute Command curl -fsSL https://thin-edge.io/install.sh | sh -s
8 changes: 4 additions & 4 deletions tests/RobotFramework/tests/installation/install_tedge.robot
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Test Teardown Get Logs

*** Test Cases ***
Install latest via script (from current branch)
Transfer To Device ${CURDIR}/../../../../get-thin-edge_io.sh /setup/
Execute Command chmod a+x /setup/get-thin-edge_io.sh && sudo /setup/get-thin-edge_io.sh
Execute Command curl -fsSL https://thin-edge.io/install.sh | sh -s
Tedge Version Should Match Regex ^\\d+\\.\\d+\\.\\d+$

# Uninstall
Expand All @@ -19,6 +18,7 @@ Install latest via script (from current branch)
Install specific version via script (from current branch)
[Documentation] Remove the tedge.toml file as the apt filter is not supported in older tedge versions
... and unknown configuration causes problems
# TODO: Remove reliance on the legacy get-thin-edge_io.sh script, however thin-edge.io/install.sh does not currently support installing a specific version
Transfer To Device ${CURDIR}/../../../../get-thin-edge_io.sh /setup/
Execute Command [ -f /etc/tedge/tedge.toml ] && sed -i '/\\[apt\\]/,/\\n/d' /etc/tedge/tedge.toml
Execute Command chmod a+x /setup/get-thin-edge_io.sh && sudo /setup/get-thin-edge_io.sh 0.8.1
Expand All @@ -28,8 +28,8 @@ Install specific version via script (from current branch)
Uninstall tedge using local Script
Tedge Should Not Be Installed tedge-log-plugin

Install latest tedge via script (from main branch)
Execute Command curl -fsSL https://raw.githubusercontent.com/thin-edge/thin-edge.io/main/get-thin-edge_io.sh | sudo sh -s
Install latest tedge via script
Execute Command curl -fsSL https://thin-edge.io/install.sh | sh -s
Tedge Version Should Match Regex ^\\d+\\.\\d+\\.\\d+$

Install then uninstall latest tedge via script (from main branch)
Expand Down
29 changes: 10 additions & 19 deletions tests/RobotFramework/tests/tedge/call_tedge.robot
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
*** Settings ***
Documentation Purpose of this test is to verify that the proper version number
... will be shown by using the tedge -V command.
... By executing the tedge -h command that USAGE, OPTIONS and SUBCOMMANDS
... By executing the tedge -h command that Usage, Options and Commands
... will be shown
... By executing the tedge -h -V command combination of both previous
... commands will be shown
Resource ../../resources/common.resource
Library ThinEdgeIO
Expand All @@ -19,9 +17,9 @@ ${version}

*** Test Cases ***
Install thin-edge.io
${output}= Execute Command curl -fsSL https://raw.githubusercontent.com/thin-edge/thin-edge.io/main/get-thin-edge_io.sh | sudo sh -s #running the script for installing latest version of tedge
${line} Get Line ${output} 0 # Get the version which is installed out of the log
${version} Fetch From Right ${line} : # Cutting log output in order only to keep version number
${output}= Execute Command curl -fsSL https://thin-edge.io/install.sh | sh -s #running the script for installing latest version of tedge
# Use apt-cache policy to get the installed version as the script lets apt handle this
${version}= Execute Command apt-cache policy tedge | grep "Installed:" | cut -d":" -f2 | xargs
Set Suite Variable ${version}

call tedge -V
Expand All @@ -30,22 +28,15 @@ call tedge -V

call tedge -h
${output}= Execute Command tedge -h
Should Contain ${output} USAGE:
Should Contain ${output} OPTIONS:
Should Contain ${output} SUBCOMMANDS:

call tedge -h -V
${output}= Execute Command tedge -h -V # Execute command to call help and check the version at same time
Should Contain ${output} ${version} # Check that the output of tedge -V returns the version which was installed
Should Contain ${output} USAGE:
Should Contain ${output} OPTIONS:
Should Contain ${output} SUBCOMMANDS:
Should Contain ${output} Usage:
Should Contain ${output} Options:
Should Contain ${output} Commands:

call tedge help
${output}= Execute Command tedge help
Should Contain ${output} USAGE:
Should Contain ${output} OPTIONS:
Should Contain ${output} SUBCOMMANDS:
Should Contain ${output} Usage:
Should Contain ${output} Options:
Should Contain ${output} Commands:

*** Keywords ***

Expand Down
8 changes: 4 additions & 4 deletions tests/images/debian-systemd/files/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ FLAGS
INSTALL METHODS
local - Install the thin-edge.io .deb packages found locally on the disk under '--install-sourcedir <path>'
apt - Install using public APT repository
script - Install using the get-thin-edge_io.sh script from GitHub
script - Install using the https://thin-edge.io/install.sh script
EXAMPLES
sudo -E $0
Expand Down Expand Up @@ -516,7 +516,7 @@ install_via_script() {
curl -fsSL https://raw.githubusercontent.com/thin-edge/thin-edge.io/main/get-thin-edge_io.sh | sudo sh -s "$VERSION"
else
echo "Installing latest official version"
curl -fsSL https://raw.githubusercontent.com/thin-edge/thin-edge.io/main/get-thin-edge_io.sh | sudo sh -s
curl -fsSL https://thin-edge.io/install.sh | sh -s
fi
}

Expand All @@ -538,7 +538,7 @@ install_via_local_files() {

ARCH=$(get_debian_arch)

# Install tedge packages in same order as the get-thin-edge_io.sh script
# Install tedge packages
find_then_install_deb "$INSTALL_SOURCEDIR" "tedge_[0-9]*_$ARCH.deb"
find_then_install_deb "$INSTALL_SOURCEDIR" "tedge[_-]mapper_*_$ARCH.deb"
find_then_install_deb "$INSTALL_SOURCEDIR" "tedge[_-]agent_*_$ARCH.deb"
Expand Down Expand Up @@ -652,7 +652,7 @@ install_tedge() {
;;

*)
echo "Installing thin-edge.io using the 'get-thin-edge_io.sh' script"
echo "Installing thin-edge.io using the install script"
# Remove system.toml as the latest official release does not support custom reboot command
rm -f /etc/tedge/system.toml
install_via_script
Expand Down

1 comment on commit c4c8a55

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
355 1 3 356 99.72 58m52.246s

Failed Tests

Name Message ⏱️ Duration Suite
Test if all c8y services are using configured service type AssertionError 185.374 s Service Monitoring

Please sign in to comment.