Skip to content

Commit

Permalink
fix e2e tests, improve err msg
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Nowak-Liebiediew committed Jul 20, 2023
1 parent 5fe753a commit 3d49880
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
5 changes: 3 additions & 2 deletions e2e/tests-dfx/extension.bash
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,9 @@ EOF
# # Wait until the server is up
while ! echo exit | nc localhost "$port"; do sleep 1; done
echo "Server is up"
# disable yes/no prompt
CI=true assert_command dfx extension install test_extension --registry "http://localhost:$port/registry.json"
echo yes | (
assert_command dfx extension install test_extension --registry "http://localhost:$port/registry.json"
)
kill $pid

assert_command dfx extension list
Expand Down
12 changes: 0 additions & 12 deletions src/dfx-core/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ pub fn ask_for_consent(message: &str) -> Result<(), UserConsent> {
eprintln!("{}", message);
eprintln!("Do you want to proceed? yes/No");

if is_running_inside_ci() {
return Ok(());
}
let mut input_string = String::new();
stdin()
.read_line(&mut input_string)
Expand All @@ -20,12 +17,3 @@ pub fn ask_for_consent(message: &str) -> Result<(), UserConsent> {
}
Ok(())
}

fn is_running_inside_ci() -> bool {
std::env::var_os("GITHUB_ACTIONS").is_some()
|| std::env::var_os("GITLAB_CI").is_some()
|| std::env::var_os("TRAVIS").is_some()
|| std::env::var_os("CIRCLECI").is_some()
|| std::env::var_os("JENKINS_URL").is_some()
|| std::env::var_os("CI").is_some()
}
3 changes: 3 additions & 0 deletions src/dfx-core/src/error/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ pub enum ExtensionError {
#[error("Platform '{}' and architecture '{}' is not supported for extension '{}' defined in manifest downloaded from '{}'.", _0.0, _0.1, _0.2, _0.3)]
PlatformArchCombinationNotFoundInManifest(Box<(url::Url, String, String, String)>),

#[error("Cannot save extension manifest: {0}")]
SaveExtensionManifestFailed(crate::error::structured_file::StructuredFileError),

// errors related to uninstalling extensions
#[error("Cannot uninstall extension: {0}")]
InsufficientPermissionsToDeleteExtensionDirectory(crate::error::fs::FsError),
Expand Down
4 changes: 1 addition & 3 deletions src/dfx-core/src/extension/manager/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ impl ExtensionManager {
.join("extension.json"),
&extension_manifest,
)
.map_err(
|e| ExtensionError::CommandAlreadyExists(e.to_string()), // TODO
)?;
.map_err(|e| ExtensionError::SaveExtensionManifestFailed(e))?;
}
self.finalize_installation(
extension_name,
Expand Down

0 comments on commit 3d49880

Please sign in to comment.