serverinit: fix flaky test. sort publishRoot prefixes, for predictable output

Change-Id: I230a7d344f9c982539b3ed6d3a88eb1066322ea5
This commit is contained in:
Brad Fitzpatrick 2014-03-14 12:08:43 -07:00
parent bf4e8f7238
commit bfbf660cd1
2 changed files with 8 additions and 6 deletions

View File

@ -22,6 +22,7 @@ import (
"net/url"
"os"
"path/filepath"
"sort"
"strings"
"camlistore.org/pkg/blob"
@ -52,8 +53,8 @@ var (
func addPublishedConfig(prefixes jsonconfig.Obj,
published map[string]*serverconfig.Publish,
sourceRoot string) ([]interface{}, error) {
pubPrefixes := []interface{}{}
sourceRoot string) ([]string, error) {
var pubPrefixes []string
for k, v := range published {
name := strings.Replace(k, "/", "", -1)
rootName := name + "Root"
@ -96,13 +97,14 @@ func addPublishedConfig(prefixes jsonconfig.Obj,
prefixes[k] = ob
pubPrefixes = append(pubPrefixes, k)
}
sort.Strings(pubPrefixes)
return pubPrefixes, nil
}
func addUIConfig(params *configPrefixesParams,
prefixes jsonconfig.Obj,
uiPrefix string,
published []interface{},
published []string,
sourceRoot string) {
args := map[string]interface{}{
@ -626,7 +628,7 @@ func genLowLevelConfig(conf *serverconfig.Config) (lowLevelConf *Config, err err
}
}
published := []interface{}{}
var published []string
if len(conf.Publish) > 0 {
if !runIndex {
return nil, fmt.Errorf("publishing requires an index")

View File

@ -146,8 +146,8 @@
"cache": "/cache/",
"jsonSignRoot": "/sighelper/",
"publishRoots": [
"/pics/",
"/music/"
"/music/",
"/pics/"
],
"scaledImage": {
"file": "/tmp/blobs/thumbmeta.kv",