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

version: fix package and tests #195

Merged
merged 8 commits into from Jul 1, 2014
Merged

version: fix package and tests #195

merged 8 commits into from Jul 1, 2014

Conversation

davecheney
Copy link
Contributor

Introduce mustOsVersion, which replaces osVersion, and panics if the version cannot be determined.

osVersion now returns an error value if it cannot determine the series.

Fix the tests so they actually compile and pass on OSX.

"github.com/juju/utils/exec"
)

func osVersion() (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The idea was that we should keep the majority of the code in shared code, to make testing easier (obviously we'd need to mock out the command execution for this). Doesn't matter much at the moment, since there's no tests.

@axw
Copy link
Contributor

axw commented Jun 30, 2014

Please check with @wallyworld about SupportedSeries. If we shouldn't be calling it on the client side, then I think the simplestreams code may need to change.

@davecheney
Copy link
Contributor Author

PTAL

@axw
Copy link
Contributor

axw commented Jun 30, 2014

s/mustOsVersion/mustOSVersion/
as in https://code.google.com/p/go-wiki/wiki/CodeReviewComments#Initialisms
(sorry, thought I added that comment before)

@davecheney
Copy link
Contributor Author

PTAL

@@ -46,11 +60,11 @@ func kernelToMajor(getKernelVersion kernelVersionFunc) (int, error) {
return int(majorVersion), nil
}

func macOSXSeriesFromKernelVersion(getKernelVersion kernelVersionFunc) string {
func macOSXSeriesFromKernelVersion(getKernelVersion func() (string, error)) (string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Why is MacOS stuff here? Shouldn't it be in osversion_darwin.go?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's here so that it can be tested on all platforms.

This is part of a larger problem that the version package is now serving two masters.

One use of version is for the client to try to figure out which tools it needs to upload, as well as simple stuff, like printing its own version with juju version. In this case the version package needs to compile and run on all platforms that the juju cli runs on.

The other use is the server, which is interested in answering questions like 'Which platform am I running on now?", "What is the version string of the tools I need to fetch"

These two use cases are complimentary, and sometimes overlap, but have pulled this package in two independent directions.

@wallyworld
Copy link
Member

I think there's a trivial fix so that this can land on still support Ubuntu workloads on WIndows/MacOS clients - only error is ubuntu.csv cannot be found if on a Ubuntu client, otherwise just use the hard coded values.

@axw
Copy link
Contributor

axw commented Jul 1, 2014

LGTM

@davecheney
Copy link
Contributor Author

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Jul 1, 2014

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@axw
Copy link
Contributor

axw commented Jul 1, 2014

Build failed: dunno why

@axw
Copy link
Contributor

axw commented Jul 1, 2014

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Jul 1, 2014

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@davecheney
Copy link
Contributor Author

$$merge$$

ಠ︵ಠ凸 [f* u]

@davecheney
Copy link
Contributor Author

$$merge$$

@axw
Copy link
Contributor

axw commented Jul 1, 2014

Build failed: magic constants

@axw
Copy link
Contributor

axw commented Jul 1, 2014

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Jul 1, 2014

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot
Copy link
Collaborator

jujubot commented Jul 1, 2014

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/313

@axw
Copy link
Contributor

axw commented Jul 1, 2014

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Jul 1, 2014

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot
Copy link
Collaborator

jujubot commented Jul 1, 2014

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/317

@axw
Copy link
Contributor

axw commented Jul 1, 2014

$$merge$$

On Tue, Jul 1, 2014 at 7:58 PM, Juju bot notifications@github.com wrote:

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/317


Reply to this email directly or view it on GitHub
#195 (comment).

@jujubot
Copy link
Collaborator

jujubot commented Jul 1, 2014

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@davecheney
Copy link
Contributor Author

This is futile.

On Tue, Jul 1, 2014 at 10:00 PM, Juju bot notifications@github.com wrote:

Status: merge request accepted. Url:
http://juju-ci.vapour.ws:8080/job/github-merge-juju

Reply to this email directly or view it on GitHub
#195 (comment).

jujubot added a commit that referenced this pull request Jul 1, 2014
version: fix package and tests

Introduce `mustOsVersion`, which replaces `osVersion`, and panics if the version cannot be determined.

`osVersion` now returns an error value if it cannot determine the series.

Fix the tests so they actually _compile_ and _pass_ on OSX.
@jujubot jujubot merged commit 93ab153 into juju:master Jul 1, 2014
@davecheney davecheney deleted the 118-fix-os-version-some-more branch April 13, 2016 23:57
laszlokajtar pushed a commit to laszlokajtar/juju that referenced this pull request Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants