Merge pull request #8562 from owncloud/port/prs-8547-8540
[tests-only] Port pr #8547 and #8540
This commit is contained in:
+3
-3
@@ -143,8 +143,8 @@ config = {
|
|||||||
"skip": False,
|
"skip": False,
|
||||||
},
|
},
|
||||||
"rocketchat": {
|
"rocketchat": {
|
||||||
"channel": "ocis-internal",
|
"channel": "infinitescale",
|
||||||
"from_secret": "rocketchat_chat_webhook",
|
"from_secret": "rocketchat_talk_webhook",
|
||||||
},
|
},
|
||||||
"binaryReleases": {
|
"binaryReleases": {
|
||||||
"os": ["linux", "darwin"],
|
"os": ["linux", "darwin"],
|
||||||
@@ -1988,7 +1988,7 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on =
|
|||||||
|
|
||||||
wrapper_commands = [
|
wrapper_commands = [
|
||||||
"make -C %s build" % dirs["ocisWrapper"],
|
"make -C %s build" % dirs["ocisWrapper"],
|
||||||
"%s/bin/ociswrapper serve --bin %s --url %s" % (dirs["ocisWrapper"], ocis_bin, OCIS_URL),
|
"%s/bin/ociswrapper serve --bin %s --url %s --admin-username admin --admin-password admin" % (dirs["ocisWrapper"], ocis_bin, OCIS_URL),
|
||||||
]
|
]
|
||||||
|
|
||||||
wait_for_ocis = {
|
wait_for_ocis = {
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ func serveCmd() *cobra.Command {
|
|||||||
ocisConfig.Set("bin", cmd.Flag("bin").Value.String())
|
ocisConfig.Set("bin", cmd.Flag("bin").Value.String())
|
||||||
ocisConfig.Set("url", cmd.Flag("url").Value.String())
|
ocisConfig.Set("url", cmd.Flag("url").Value.String())
|
||||||
ocisConfig.Set("retry", cmd.Flag("retry").Value.String())
|
ocisConfig.Set("retry", cmd.Flag("retry").Value.String())
|
||||||
|
ocisConfig.Set("adminUsername", cmd.Flag("admin-username").Value.String())
|
||||||
|
ocisConfig.Set("adminPassword", cmd.Flag("admin-password").Value.String())
|
||||||
|
|
||||||
go ocis.Start(nil)
|
go ocis.Start(nil)
|
||||||
go wrapper.Start(cmd.Flag("port").Value.String())
|
go wrapper.Start(cmd.Flag("port").Value.String())
|
||||||
@@ -45,6 +47,8 @@ func serveCmd() *cobra.Command {
|
|||||||
serveCmd.Flags().StringP("url", "", ocisConfig.Get("url"), "oCIS server url")
|
serveCmd.Flags().StringP("url", "", ocisConfig.Get("url"), "oCIS server url")
|
||||||
serveCmd.Flags().StringP("retry", "", ocisConfig.Get("retry"), "Number of retries to start oCIS server")
|
serveCmd.Flags().StringP("retry", "", ocisConfig.Get("retry"), "Number of retries to start oCIS server")
|
||||||
serveCmd.Flags().StringP("port", "p", wrapperConfig.Get("port"), "Wrapper API server port")
|
serveCmd.Flags().StringP("port", "p", wrapperConfig.Get("port"), "Wrapper API server port")
|
||||||
|
serveCmd.Flags().StringP("admin-username", "", "", "admin username for oCIS server")
|
||||||
|
serveCmd.Flags().StringP("admin-password", "", "", "admin password for oCIS server")
|
||||||
|
|
||||||
return serveCmd
|
return serveCmd
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
var config = map[string]string{
|
var config = map[string]string{
|
||||||
"bin": "/usr/bin/ocis",
|
"bin": "/usr/bin/ocis",
|
||||||
"url": "https://localhost:9200",
|
"url": "https://localhost:9200",
|
||||||
"retry": "5",
|
"retry": "5",
|
||||||
|
"adminUsername": "",
|
||||||
|
"adminPassword": "",
|
||||||
}
|
}
|
||||||
|
|
||||||
func Set(key string, value string) {
|
func Set(key string, value string) {
|
||||||
|
|||||||
@@ -125,7 +125,24 @@ func Stop() {
|
|||||||
waitUntilCompleteShutdown()
|
waitUntilCompleteShutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func listAllServices(startTime time.Time, timeout time.Duration) {
|
||||||
|
timeoutS := timeout * time.Second
|
||||||
|
|
||||||
|
c := exec.Command(config.Get("bin"), "list")
|
||||||
|
_, err := c.CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
if time.Since(startTime) <= timeoutS {
|
||||||
|
time.Sleep(500 * time.Millisecond)
|
||||||
|
listAllServices(startTime, timeout)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Println("All services are up")
|
||||||
|
}
|
||||||
|
|
||||||
func WaitForConnection() bool {
|
func WaitForConnection() bool {
|
||||||
|
listAllServices(time.Now(), 30)
|
||||||
|
|
||||||
transport := &http.Transport{
|
transport := &http.Transport{
|
||||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||||
}
|
}
|
||||||
@@ -137,7 +154,14 @@ func WaitForConnection() bool {
|
|||||||
Transport: transport,
|
Transport: transport,
|
||||||
}
|
}
|
||||||
|
|
||||||
req, _ := http.NewRequest("GET", config.Get("url")+"/ocs/v1.php/cloud/capabilities?format=json", nil)
|
var req *http.Request
|
||||||
|
if config.Get("adminUsername") != "" && config.Get("adminPassword") != "" {
|
||||||
|
req, _ = http.NewRequest("GET", config.Get("url")+"/graph/v1.0/me/drives", nil)
|
||||||
|
req.SetBasicAuth(config.Get("adminUsername"), config.Get("adminPassword"))
|
||||||
|
} else {
|
||||||
|
req, _ = http.NewRequest("GET", config.Get("url")+"/ocs/v1.php/cloud/capabilities?format=json", nil)
|
||||||
|
}
|
||||||
|
|
||||||
timeout := time.After(timeoutValue)
|
timeout := time.After(timeoutValue)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
|||||||
Reference in New Issue
Block a user