Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat: FVM self subcommand #3570

Closed
wants to merge 13 commits into from
Closed

[Merged by Bors] - feat: FVM self subcommand #3570

wants to merge 13 commits into from

Conversation

EstebanBorai
Copy link
Contributor

@EstebanBorai EstebanBorai commented Sep 30, 2023

Introduces a subcommand for installing/uninstalling and in the short term also updating
FVM. This command is in charge of preparing the environment for FVM before installing
and switching Fluvio Versions.


Demo

CleanShot 2023-09-30 at 19 21 45

crates/fluvio-version-manager/Cargo.toml Outdated Show resolved Hide resolved
crates/fluvio-version-manager/Cargo.toml Outdated Show resolved Hide resolved
crates/fluvio-version-manager/Cargo.toml Outdated Show resolved Hide resolved
crates/fluvio-version-manager/Cargo.toml Outdated Show resolved Hide resolved
crates/fluvio-version-manager/src/common/workdir.rs Outdated Show resolved Hide resolved
crates/fluvio-version-manager/src/common/workdir.rs Outdated Show resolved Hide resolved
crates/fluvio-version-manager/src/main.rs Outdated Show resolved Hide resolved
@sehz
Copy link
Contributor

sehz commented Sep 30, 2023

please add CLI tests in addition to unit test

@EstebanBorai EstebanBorai requested a review from sehz October 2, 2023 14:39
@ajhunyady
Copy link
Contributor

@EstebanBorai do we also need an update self command.

@EstebanBorai
Copy link
Contributor Author

@EstebanBorai do we also need an update self command.

As of today we will rely on the install script given for updating FVM, in the future we are likely to implement a dedicated approach.

@EstebanBorai EstebanBorai requested a review from sehz October 2, 2023 22:00
Copy link
Contributor

@sehz sehz left a comment

Choose a reason for hiding this comment

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

Still missing CLI / Unit tests.

I would expect following tests:

$ ../fvm self-install
$ .../fvm uninstall

And test to ensure directory is created correctly (install) with stable channel. and test to ensure everything is removed correctly

.github/workflows/ci.yml Outdated Show resolved Hide resolved
#[derive(Debug, Serialize, Deserialize)]
pub struct Settings {
/// The active `channel` for the Fluvio Installation
pub channel: Option<Channel>,
Copy link
Contributor

Choose a reason for hiding this comment

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

this needs to be fixed. it is probably most critical part of this PR


#[test]
fn update_settings_file() {
create_fvm_dir();
Copy link
Contributor

Choose a reason for hiding this comment

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

why this is calling this? shouldn't installation step should take care of it?

Copy link
Contributor Author

@EstebanBorai EstebanBorai Oct 2, 2023

Choose a reason for hiding this comment

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

This is testing tho Settings file creation only, these are unit tests on the Settings struct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

shouldn't installation step should take care of it?
Yeah! The command takes care of this but the Settings struct is not responsible of creating the directory.

In this context we just create the settings.toml file, se I have to prepare the environment for unit tests in this context

@EstebanBorai
Copy link
Contributor Author

Still missing CLI / Unit tests.

I would expect following tests:


$ ../fvm self-install


$ .../fvm uninstall

And test to ensure directory is created correctly (install) with stable channel. and test to ensure everything is removed correctly

I think the tests you are mentioning are here: https://github.com/infinyon/fluvio/blob/8053a155b08ffc92b5e08ee8cae26dd9863c02ac/tests/cli/fvm_smoke_tests/fvm_basic.bats perhaps?

@sehz
Copy link
Contributor

sehz commented Oct 2, 2023

These tests doesnt do anything since they dont have any validation

@EstebanBorai
Copy link
Contributor Author

These tests doesnt do anything since they dont have any validation

Oh! Sorry about that! I just updated tests, now I also check the presence of the ~/.fvm/bin/fvm.

Im testing the following assertions:

fvm self install

  1. Create the ~/.fvm directory
  2. Create a settings.toml, but as no version of Fluvio has been installed already, the settings.toml remains empty as of this phase
  3. Copies the fvm binary to ~/.fvm/bin/fvm
  4. Prints the command to add fvm to the path for the user

fvm self uninstall

  1. Delete the ~/.fvm directory.

Previously I was checking the settings file to be there, is important to keep in mind that fvm self install doesnh have any side effects, no fluvio versions will be installed as of this phase. The settings.toml content is empty as no versions has been installed so far.

In the following iteration, with fvm install, settings.toml will be updated to have the
versions and channels that are active.

@EstebanBorai EstebanBorai requested a review from sehz October 3, 2023 02:16
@EstebanBorai
Copy link
Contributor Author

@sehz just checked for existence using test command.
Checking for each file to be present, lets see how this goes through CI!

@EstebanBorai EstebanBorai requested review from digikata and sehz October 3, 2023 21:03
@EstebanBorai
Copy link
Contributor Author

bors r+

bors bot pushed a commit that referenced this pull request Oct 3, 2023
Introduces a subcommand for installing/uninstalling and in the short term also updating
FVM. This command is in charge of preparing the environment for FVM before installing
and switching Fluvio Versions.

---

## Demo

![CleanShot 2023-09-30 at 19 21 45](https://github.com/infinyon/fluvio/assets/34756077/57fc1a71-a122-4658-b4b8-6e11443a8ceb)
@EstebanBorai
Copy link
Contributor Author

Thanks for your time @sehz and @digikata! Moving into fvm install now!
Refer: #3573

@sehz
Copy link
Contributor

sehz commented Oct 3, 2023

There is an issue with the setting config. Please address them on next PR

@bors
Copy link

bors bot commented Oct 3, 2023

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title feat: FVM self subcommand [Merged by Bors] - feat: FVM self subcommand Oct 3, 2023
@bors bors bot closed this Oct 3, 2023
@sehz sehz added this to the 0.10.16 milestone Oct 7, 2023
@EstebanBorai EstebanBorai linked an issue Oct 11, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FVM - Installation
4 participants