Skip to content

Commit

Permalink
feat: cli e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EstebanBorai committed Oct 31, 2023
1 parent 59663a2 commit 5ce57bc
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
1 change: 0 additions & 1 deletion crates/fluvio-version-manager/src/command/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use anyhow::{Result, Error};
use clap::Args;
use colored::Colorize;
use semver::Version;
use url::Url;

use fluvio_hub_util::HUB_REMOTE;
Expand Down
65 changes: 65 additions & 0 deletions tests/cli/fvm_smoke_tests/fvm_basic.bats
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ setup_file() {

FVM_CARGO_TOML_VERSION="$(yq -oy '.package.version' ./crates/fluvio-version-manager/Cargo.toml)"
export FVM_CARGO_TOML_VERSION
debug_msg "FVM Cargo.toml Version: $FVM_CARGO_TOML_VERSION"

VERSION_FILE="$(cat ./VERSION)"
export VERSION_FILE
debug_msg "Version File Value: $FVM_CARGO_TOML_VERSION"
}

Expand Down Expand Up @@ -670,3 +674,64 @@ setup_file() {
rm -rf $FLUVIO_HOME_DIR
assert_success
}

@test "Updates version in stable channel" {
run bash -c '$FVM_BIN self install'
assert_success

# Sets `fvm` in the PATH using the "env" file included in the installation
source ~/.fvm/env

# Installs the stable version
run bash -c 'fvm install stable'
assert_success

# Changes the version set as `stable` channel to $STATIC_VERSION in order to
# force an update. $STATIC_VERSION just to reuse the variable to improve
# readability, it could be any version tag (but stable of course!)
sed -i "" "s/$STABLE_VERSION/$STATIC_VERSION/g" $FVM_HOME_DIR/settings.toml

# Attempts to update Fluvio
run bash -c 'fvm update'
assert_line --index 0 "info: Updating fluvio stable to version $STABLE_VERSION. Current version is $STATIC_VERSION."
assert_success

# Removes FVM
run bash -c 'fvm self uninstall --yes'
assert_success

# Removes Fluvio
rm -rf $FLUVIO_HOME_DIR
assert_success
}

@test "Updates version in latest channel" {
run bash -c '$FVM_BIN self install'
assert_success

# Sets `fvm` in the PATH using the "env" file included in the installation
source ~/.fvm/env

# Installs the stable version
run bash -c 'fvm install latest'
assert_success

# Changes the version set as `stable` channel to $STATIC_VERSION in order to
# force an update. $STATIC_VERSION just to reuse the variable to improve
# readability.
sed -i "" "s/$VERSION_FILE/$STATIC_VERSION/g" $FVM_HOME_DIR/settings.toml

# Attempts to update Fluvio
run bash -c 'fvm update'
assert_line --index 0 --partial "info: Updating fluvio latest to version $VERSION_FILE"
assert_line --index 0 --partial "Current version is $STATIC_VERSION+"
assert_success

# Removes FVM
run bash -c 'fvm self uninstall --yes'
assert_success

# Removes Fluvio
rm -rf $FLUVIO_HOME_DIR
assert_success
}

0 comments on commit 5ce57bc

Please sign in to comment.