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

Adding unit test for Version method #561

Merged
merged 1 commit into from
Oct 2, 2018

Conversation

Pensu
Copy link
Contributor

@Pensu Pensu commented Oct 1, 2018

@codecov
Copy link

codecov bot commented Oct 1, 2018

Codecov Report

Merging #561 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #561      +/-   ##
=========================================
+ Coverage   31.58%   31.6%   +0.01%     
=========================================
  Files         138     138              
  Lines       10943   10943              
=========================================
+ Hits         3456    3458       +2     
+ Misses       7225    7223       -2     
  Partials      262     262
Impacted Files Coverage Δ
pkg/install/v1alpha1/version.go 100% <0%> (+25%) ⬆️

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 156cd3a...6ae1888. Read the comment docs.

validatedVersion := Version(string(tt.version))
if !reflect.DeepEqual(string(validatedVersion), tt.expversion) {
t.Errorf("Version error %v", validatedVersion)
}
Copy link
Contributor

@prateekpandey14 prateekpandey14 Oct 1, 2018

Choose a reason for hiding this comment

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

@Pensu thanks for the PR ..... can we make error more clearer. for example:
t.Errorf ( "version error, got version: %v , expected version: %v ", validatedVersion, tt.expversion)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@prateekpandey14 Made the changes. PTAL.

func TestVersion(t *testing.T) {
tests := map[string]struct {
version string
expversion string
Copy link
Contributor

Choose a reason for hiding this comment

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

expVersion or expectedVersion

Copy link
Contributor Author

@Pensu Pensu Oct 1, 2018

Choose a reason for hiding this comment

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

@princerachit Just wanted to keep it short, so abbreviated expected to exp, you want to put expected?


func TestVersion(t *testing.T) {
tests := map[string]struct {
version string
Copy link
Contributor

Choose a reason for hiding this comment

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

this is also good but maybe inputVersion is better. what do you think @prateekpandey14 ?

Copy link
Contributor

@princerachit princerachit left a comment

Choose a reason for hiding this comment

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

Please address the changes.

for name, tt := range tests {
t.Run(name, func(t *testing.T) {
validatedVersion := Version(string(tt.version))
if !reflect.DeepEqual(string(validatedVersion), tt.expversion) {

Choose a reason for hiding this comment

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

Please avoid reflect to do a string comparison.

Copy link
Contributor

@princerachit princerachit left a comment

Choose a reason for hiding this comment

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

Lgtm

Copy link
Contributor

@sonasingh46 sonasingh46 left a comment

Choose a reason for hiding this comment

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

LGTM

@sonasingh46 sonasingh46 merged commit bf1b2b4 into openebs-archive:master Oct 2, 2018
@Pensu Pensu deleted the version_test branch October 2, 2018 08:31
kmova added a commit to kmova/openebs that referenced this pull request Jul 15, 2020
Refer: [GOVERNANCE.md](https://github.com/openebs/openebs/blob/master/GOVERNANCE.md).

The following community members have been helping with enhancing and testing
of several areas of the OpenEBS project that broadly fall in the purview of the
control plane.

Based on their past contributions and their interest/commitment to contributing
to OpenEBS, we take pride in adding them as reviewers to the OpenEBS project.

The list of community members in alphabetical order are:

- Mehran Kholdi for the contributions to the Local PV and control plane in general.
  ```
  - openebs#2975
  - 40+ commits in https://github.com/openebs/rawfile-localpv
  ```

- Michael Fornaro for the contributions to the ARM, Multi-arch builds and helm charts that fall under control plane.
  ```
  - openebs-archive/e2e-tests#405
  - openebs#3038
  - openebs#3023
  - openebs#3037
  - openebs#1295
  - openebs/linux-utils#5
  - openebs-archive/node-disk-manager#446
  - openebs-archive/node-disk-manager#449
  - openebs-archive/node-disk-manager#428
  ```

- Peeyush Gupta for the contributions to the Power builds and control plane in general.
  ```
  - openebs/charts#127
  - openebs-archive/node-disk-manager#448
  - openebs-archive/maya#1632
  - openebs-archive/jiva#279
  - openebs-archive/maya#667
  - openebs-archive/istgt#131
  - openebs-archive/maya#561
  - openebs-archive/maya#750
  ```

Signed-off-by: kmova <[email protected]>
kmova added a commit to openebs/openebs that referenced this pull request Jul 15, 2020
Refer: [GOVERNANCE.md](https://github.com/openebs/openebs/blob/master/GOVERNANCE.md).

The following community members have been helping with enhancing and testing
of several areas of the OpenEBS project that broadly fall in the purview of the
control plane.

Based on their past contributions and their interest/commitment to contributing
to OpenEBS, we take pride in adding them as reviewers to the OpenEBS project.

The list of community members in alphabetical order are:

- Mehran Kholdi for the contributions to the Local PV and control plane in general.
  ```
  - #2975
  - 40+ commits in https://github.com/openebs/rawfile-localpv
  ```

- Michael Fornaro for the contributions to the ARM, Multi-arch builds and helm charts that fall under control plane.
  ```
  - openebs-archive/e2e-tests#405
  - #3038
  - #3023
  - #3037
  - #1295
  - openebs/linux-utils#5
  - openebs-archive/node-disk-manager#446
  - openebs-archive/node-disk-manager#449
  - openebs-archive/node-disk-manager#428
  ```

- Peeyush Gupta for the contributions to the Power builds and control plane in general.
  ```
  - openebs/charts#127
  - openebs-archive/node-disk-manager#448
  - openebs-archive/maya#1632
  - openebs-archive/jiva#279
  - openebs-archive/maya#667
  - openebs-archive/istgt#131
  - openebs-archive/maya#561
  - openebs-archive/maya#750
  ```

Signed-off-by: kmova <[email protected]>
Akshay-Nagle pushed a commit to Akshay-Nagle/openebs that referenced this pull request Oct 7, 2020
Refer: [GOVERNANCE.md](https://github.com/openebs/openebs/blob/master/GOVERNANCE.md).

The following community members have been helping with enhancing and testing
of several areas of the OpenEBS project that broadly fall in the purview of the
control plane.

Based on their past contributions and their interest/commitment to contributing
to OpenEBS, we take pride in adding them as reviewers to the OpenEBS project.

The list of community members in alphabetical order are:

- Mehran Kholdi for the contributions to the Local PV and control plane in general.
  ```
  - openebs#2975
  - 40+ commits in https://github.com/openebs/rawfile-localpv
  ```

- Michael Fornaro for the contributions to the ARM, Multi-arch builds and helm charts that fall under control plane.
  ```
  - openebs-archive/e2e-tests#405
  - openebs#3038
  - openebs#3023
  - openebs#3037
  - openebs#1295
  - openebs/linux-utils#5
  - openebs-archive/node-disk-manager#446
  - openebs-archive/node-disk-manager#449
  - openebs-archive/node-disk-manager#428
  ```

- Peeyush Gupta for the contributions to the Power builds and control plane in general.
  ```
  - openebs/charts#127
  - openebs-archive/node-disk-manager#448
  - openebs-archive/maya#1632
  - openebs-archive/jiva#279
  - openebs-archive/maya#667
  - openebs-archive/istgt#131
  - openebs-archive/maya#561
  - openebs-archive/maya#750
  ```

Signed-off-by: kmova <[email protected]>
Signed-off-by: Kung Fu Panda <[email protected]>
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.

5 participants