Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Switch context to env command #706

Merged
merged 14 commits into from
Dec 8, 2020

Conversation

kaduartur
Copy link
Contributor

Description

All context commands have been deprecated and new envs created:

  • rit set context ➡️ rit set env
  • rit show context ➡️ rit show env
  • rit delete context ➡️ rit delete env

How to verify it

All new commands must behave as the old commands worked, only with the difference that now instead of context we have environments.

Changelog

Switch context to env command

* Move rcontext to env

Signed-off-by: Kadu Artur Prussek <[email protected]>

* Fix test

Signed-off-by: Kadu Artur Prussek <[email protected]>

* Fix lint

Signed-off-by: Kadu Artur Prussek <[email protected]>
* Create new command rit set env

Signed-off-by: Kadu Artur Prussek <[email protected]>

* Remove the redundant Env variable names

Signed-off-by: Kadu Artur Prussek <[email protected]>
Signed-off-by: Kadu Artur Prussek <[email protected]>
* Create new command rit show env

Signed-off-by: Kadu Artur Prussek <[email protected]>

* Create new command rit delete env

Signed-off-by: Kadu Artur Prussek <[email protected]>

* Fix functional tests

Signed-off-by: Kadu Artur Prussek <[email protected]>

* Fix functional tests

Signed-off-by: Kadu Artur Prussek <[email protected]>
* Convert contexts to envs by postinst.sh

Signed-off-by: Kadu Artur Prussek <[email protected]>

* Remove Mac script

Signed-off-by: Kadu Artur Prussek <[email protected]>

* Add install.sh

Signed-off-by: Kadu Artur Prussek <[email protected]>

* Update install.sh

Signed-off-by: Kadu Artur Prussek <[email protected]>

* Create convert contexts file to envs file

Signed-off-by: Kadu Artur Prussek <[email protected]>

* Remove compatibility script

Signed-off-by: Kadu Artur Prussek <[email protected]>
Signed-off-by: Kadu Artur Prussek <[email protected]>
Signed-off-by: Kadu Artur Prussek <[email protected]>
@kaduartur kaduartur linked an issue Dec 2, 2020 that may be closed by this pull request
11 tasks
@codecov-io
Copy link

codecov-io commented Dec 2, 2020

Codecov Report

Merging #706 (2a206b3) into master (97964f5) will increase coverage by 0.57%.
The diff coverage is 87.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #706      +/-   ##
==========================================
+ Coverage   81.46%   82.04%   +0.57%     
==========================================
  Files         110      110              
  Lines        3669     3726      +57     
==========================================
+ Hits         2989     3057      +68     
+ Misses        495      484      -11     
  Partials      185      185              
Impacted Files Coverage Δ
pkg/credential/credential.go 0.00% <ø> (ø)
pkg/env/find_remover.go 0.00% <0.00%> (ø)
pkg/env/find_setter.go 0.00% <0.00%> (ø)
pkg/formula/formula.go 75.00% <ø> (ø)
pkg/cmd/delete_env.go 35.55% <39.13%> (ø)
pkg/cmd/set_env.go 47.22% <62.50%> (ø)
pkg/credential/setter.go 61.90% <81.81%> (+6.34%) ⬆️
pkg/cmd/root.go 71.59% <84.61%> (+5.46%) ⬆️
pkg/env/remover.go 89.47% <89.47%> (ø)
pkg/env/setter.go 89.47% <89.47%> (ø)
... and 22 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 97964f5...2a206b3. Read the comment docs.

@kaduartur kaduartur added the 🚧 WIP Work in Progress label Dec 2, 2020
pkg/cmd/mocks_test.go Outdated Show resolved Hide resolved
pkg/cmd/mocks_test.go Outdated Show resolved Hide resolved
pkg/cmd/mocks_test.go Outdated Show resolved Hide resolved
pkg/cmd/mocks_test.go Outdated Show resolved Hide resolved
@kaduartur kaduartur removed the ✔️ ready-for-review ready for review label Dec 7, 2020
Signed-off-by: Kadu Artur Prussek <[email protected]>
Signed-off-by: Kadu Artur Prussek <[email protected]>
* Rename all methods and variables named context

Signed-off-by: Kadu Artur Prussek <[email protected]>

* Fix

Signed-off-by: Kadu Artur Prussek <[email protected]>
@kaduartur kaduartur added ✔️ ready-for-review ready for review and removed 🚧 WIP Work in Progress labels Dec 8, 2020
Comment on lines +121 to +129
credentialResolver := NewResolver(tt.in.credFinder, tt.in.credSetter, tt.in.pass)
got, err := credentialResolver.Resolve(tt.in.credentialField)

if tt.out.err != nil && tt.out.err.Error() != err.Error() {
t.Errorf("Resolve(%s) got %v, want %v", tt.name, err, tt.out.err)
}
if got != tt.out.want {
t.Errorf("Resolve(%s) got %v, want %v", tt.name, got, tt.out.want)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use testify assertions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense, but I think we can do it in another task :)

Comment on lines +134 to +149
type passwordMock struct {
value string
err error
}

func (pass passwordMock) Password(string, ...string) (string, error) {
return pass.value, pass.err
}

type setCredMock struct {
err error
}

func (s setCredMock) Set(d Detail) error {
return s.err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use testify mocks? From the mock package prefereably

Copy link
Contributor

@henriquemoraeszup henriquemoraeszup left a comment

Choose a reason for hiding this comment

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

You can ignore my test comments, it might not be the scope of this pr

@kaduartur
Copy link
Contributor Author

/merge qa

@ritchie-bot
Copy link
Contributor

ritchie-bot bot commented Dec 8, 2020

👌 Merged branch feature/switch_context_to_env into qa

@kaduartur kaduartur added 🚀 QA and removed ✔️ ready-for-review ready for review labels Dec 8, 2020
Signed-off-by: Kadu Artur Prussek <[email protected]>
@kaduartur
Copy link
Contributor Author

/merge qa

@ritchie-bot
Copy link
Contributor

ritchie-bot bot commented Dec 8, 2020

👌 Merged branch feature/switch_context_to_env into qa

Copy link
Contributor

@henriquemoraeszup henriquemoraeszup left a comment

Choose a reason for hiding this comment

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

🚀

@henriquemoraeszup henriquemoraeszup merged commit b37078b into master Dec 8, 2020
@henriquemoraeszup henriquemoraeszup deleted the feature/switch_context_to_env branch December 8, 2020 20:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 improvement Improvement in features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch the command context for environment
5 participants