discoverySuite.TestDiscoverServiceLocalHost: invalid series for wily and vivid
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | juju-core |
Medium
|
James Tunnicliffe | ||
| | 1.24 |
High
|
Unassigned | ||
Bug Description
As seen in http://
there was only one failure (for wily and go 1.4.2). This test also fails on vivid.
FAIL: discovery_
[LOG] 0:00.000 DEBUG juju.service discovered init system "systemd" from series "wily"
[LOG] 0:00.000 DEBUG juju.service discovered init system "systemd" from local host
discovery_
c.Assert(err, jc.ErrorIsNil)
... value *errors.Err = &errors.
... error stack:
invalid series ""
github.
github.
OOPS: 34 passed, 1 FAILED
--- FAIL: TestPackage (0.13s
| summary: |
- discoverySuite.TestDiscoverServiceLocalHost: invalid series for wily + discoverySuite.TestDiscoverServiceLocalHost: invalid series for wily and + vivid |
| description: | updated |
| ccoblis (claudiu-coblis) wrote : | #1 |
| tags: | added: centos vivid |
| James Tunnicliffe (dooferlad) wrote : | #2 |
Have had a dig. In TestDiscoverSer
jujuVersion := getVersion()
here.Is(
here.Is(initName) // systemd
here.Is(conf) // {Desc:"some service", Transient:false, AfterStopped:"", Env:map[
here.Is(name) // a-service
service, err := newService(name, conf, initName, jujuVersion.Series)
This is because disableVersionD
func (dt discoveryTest) disableVersionD
s.PatchVersion
OS: version.Unknown,
})
}
So the entire version is zeroed out. I don't know if the intent was to only zero version.Current.OS. If you only patch the OS version the test passes, but it may not be testing correctly in that case.
The problem seems to be that in service/service.go we take the InitSystemSystemd branch, which then calls paths.DataDir, which is what causes the failure.
func newService(name string, conf common.Conf, initSystem, series string) (Service, error) {
switch initSystem {
case InitSystemWindows:
svc, err := windows.
if err != nil {
return nil, errors.
}
return svc, nil
case InitSystemUpstart:
return upstart.
case InitSystemSystemd:
dataDir, err := paths.DataDir(
if err != nil {
return nil, errors.
}
svc, err := systemd.
if err != nil {
return nil, errors.
}
return svc, nil
default:
return nil, errors.
}
}
Naturally, when we have set the series string to an empty value:
// DataDir returns a filesystem path to the folder used by juju to
// store tools, charms, locks, etc
func DataDir(series string) (string, error) {
return osVal(series, dataDir)
}
... calls ...
// osVal will lookup the value of the key valname
// in the apropriate map, based on the series. This will
// help reduce boilerplate code
func osVal(series string, valname osVarType) (string, error) {
os, err := version.
if err != nil {
return "", err
}
switch os {
case version.Windows:
return winVals[valname], nil
default:
return nixVals[valname], nil
}
}
... calls ...
// GetOSFromSeries will return the operating system based
// on the series that is passed to it
func GetOSFromSeries
if series == "" {
return Unknown, errors.
}
if _, ok := ubuntuSeries[
return Ubuntu, nil
}
if _, ok := centosSeries[
return CentOS, nil
}
for _, val := range windowsVersions {
if va...
| Changed in juju-core: | |
| status: | Triaged → Fix Committed |
| assignee: | nobody → James Tunnicliffe (dooferlad) |
| James Tunnicliffe (dooferlad) wrote : | #3 |
https:/
| Changed in juju-core: | |
| milestone: | none → 1.25.0 |
| status: | Fix Committed → Fix Released |


This test also fails on CentOS.