Skip to content

Conversation

@PierreBeucher
Copy link
Contributor

@PierreBeucher PierreBeucher commented May 16, 2024

VAULT_SKIP_VERIFY=1 was actually ENABLING verify while VAULT_SKIP_VERIFY=0 was SKIPPING verify. We want the opposite.

I was able to cargo build but not cargo test in a nix develop shell, I had failure:

$ cargo test
   Compiling vaultrs v0.7.2 (/home/pbeucher/git/vaultrs)
error[E0277]: the trait bound `Vec<std::string::String>: From<&[std::string::String; 2]>` is not satisfied
   --> tests/identity.rs:224:44
    |
224 |     identity::entity::batch_delete(client, &[entity1.id.to_string(), entity2.id.to_string()])
    |     ------------------------------         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<&[std::string::String; 2]>` is not implemented for `Vec<std::string::String>`
    |     |
    |     required by a bound introduced by this call
    |
    = note: required for `&[std::string::String; 2]` to implement `Into<Vec<std::string::String>>`
note: required by a bound in `batch_delete`
   --> /home/pbeucher/git/vaultrs/src/identity/entity.rs:77:43
    |
77  | pub async fn batch_delete<T: fmt::Debug + Into<Vec<String>>>(
    |                                           ^^^^^^^^^^^^^^^^^ required by this bound in `batch_delete`
help: consider dereferencing here
    |
224 |     identity::entity::batch_delete(client, *&[entity1.id.to_string(), entity2.id.to_string()])
    |                                            +

For more information about this error, try `rustc --explain E0277`.
error: could not compile `vaultrs` (test "identity") due to previous error
warning: build failed, waiting for other jobs to finish...
[Vaultrs Devshell]$ rustc --version
rustc 1.70.0-nightly (8be3c2bda 2023-03-24)

This does not seem related to my local changes, maybe Nix dev shell is broken?

But I hope change is simple enough, if a reviewer or owner can test it on its own :)

VAULT_SKIP_VERIFY=1 was actually ENABLING verify while VAULT_SKIP_VERIFY=0 was SKIPPING verify. We want the opposite.
Copy link
Collaborator

@Haennetz Haennetz left a comment

Choose a reason for hiding this comment

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

Thanks for the MR we should use it like the vault CLI uses it.
Only one suggestion to use assert! instate of assert_eq! but I leave it up to you if you want to apply them

env::remove_var(VAULT_SKIP_VERIFY);
let client = build_client();
assert!(client.settings.verify);
assert_eq!(client.settings.verify, true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
assert_eq!(client.settings.verify, true);
assert!(client.settings.verify);

env::set_var(VAULT_SKIP_VERIFY, value);
let client = build_client();
assert!(!client.settings.verify);
assert_eq!(client.settings.verify, true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
assert_eq!(client.settings.verify, true);
assert!(client.settings.verify);

let client = build_client();
assert!(client.settings.verify);
// Setting truthy value for SKIP_VERIFY should disable verify
assert_eq!(client.settings.verify, false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
assert_eq!(client.settings.verify, false);
assert!(!client.settings.verify);

@chriswiggins
Copy link

Gentle bump reminder on this 😄 We're having to run this in the inverted state with vaultssh

@stormshield-gt
Copy link
Collaborator

Thanks for submitting this PR, I will close these now that #160 has been merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants