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

check if volume backing store format is present before creating #569 #639

Merged

Conversation

cyril-s
Copy link
Contributor

@cyril-s cyril-s commented Sep 6, 2019

  • cover case when backing volume xml doesn't contain format element
  • add test for NewDefBackingStoreFromLibvirt
  • interface StorageVol introduced to allow mocking
  • libvirt.StorageVol is mocked using github.com/golang/mock
  • NewDefBackingStoreFromLibvirt now accepts StorageVol interface on input

I used github.com/golang/mock for mocking since it seemed to me as a better option rather than writing mocking implementations of interfaces like it's done in libvirt/libvirt_domain_mock_test.go

Closes #569

@MalloZup
Copy link
Collaborator

MalloZup commented Sep 9, 2019

thx lot for PR ! I will have look once I have free time. Looks promising thx!! 😍

@MalloZup
Copy link
Collaborator

@cyril-s so looked at this pr.

I think we can do a testacc testcase without introducing mocking and the golang interface which add complexity.

Here some pointers for you:
https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/CONTRIBUTING.md#writing-acceptance-tests

and

func TestAccLibvirtVolume_BackingStoreTestByID(t *testing.T) {

let me know if you have any other question, and thx lot for fixing the issue. great job sofar

@cyril-s
Copy link
Contributor Author

cyril-s commented Sep 13, 2019

@MalloZup so I was thinking how to implement acceptance tests for this and realized that currently there is no way to create lvm pool using this plugin. Which is clearly stated in the doc actually (and to which I didn't pay enough attention apparently). It's possible to implement testcase by creating pool without help of this plugin but it seems to me that PR that kind of fixes unsupported functionality is not very relevant. So it seems to me that this fix should go in PR which implements lvm pool support (that is something I'd like to help with). What do you think?

@MalloZup
Copy link
Collaborator

Hi.! Sorry for delay. So I personally think we don't need to test. If we add 10 lines tests for 1 line I think we can accept your pr without mocking. I don't like mocking in general and a'so introducing interfaces or coding for mocking isn't good'. So feel free to remove the mock part and preserve the code without interfaces. Thx

@MalloZup
Copy link
Collaborator

I'm saying this in context of the llvm pool, because if it is difficult to create all this isn't worth to have complex automation

…icar#569

cover case when backing volume xml doesn't contain format element
@cyril-s cyril-s force-pushed the fix_vol_backing_storage_format_nil_569 branch from 7683f75 to be29b79 Compare September 17, 2019 08:05
@cyril-s
Copy link
Contributor Author

cyril-s commented Sep 17, 2019

Ok. Removed everything except fix itself

@MalloZup
Copy link
Collaborator

@cyril-s great job, just in case. I assume you tested it manually?

After that lgtm

Copy link
Collaborator

@MalloZup MalloZup left a comment

Choose a reason for hiding this comment

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

just waiting for manual tests confirmation before merging

@cyril-s
Copy link
Contributor Author

cyril-s commented Sep 17, 2019

Yes, and I've been using the plugin with this fix for a week. No problems so far

@MalloZup MalloZup merged commit a4b95a0 into dmacvicar:master Sep 17, 2019
@MalloZup
Copy link
Collaborator

@cyril-s thx for pr merging

@cyril-s cyril-s deleted the fix_vol_backing_storage_format_nil_569 branch September 17, 2019 09:43
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.

Unable to create a resized volume when using LVM as storage pool (terraform crashing)
2 participants