Change-Id: Ida3bcf39cfdca2f4e7359a8b8ec2e83692d16dcc
Signed-off-by: Mohamed Abukar <abukar.mohamed@nokia.com>
switch r.Method {
case "GET":
suite.mu.Lock()
switch r.Method {
case "GET":
suite.mu.Lock()
+ defer suite.mu.Unlock()
http.Serve(listener, nil)
}
http.Serve(listener, nil)
}
doSleep := func(w http.ResponseWriter) {
time.Sleep(time.Second * 2)
}
doSleep := func(w http.ResponseWriter) {
time.Sleep(time.Second * 2)
}
suite.xAppMgrFunc = doSleep
suite.xAppMgrFunc = doSleep
data, err := queryXAppsConfig("http://"+suite.listener.Addr().String()+"/test_url/", 1)
suite.Equal([]byte("{}"), data)
data, err := queryXAppsConfig("http://"+suite.listener.Addr().String()+"/test_url/", 1)
suite.Equal([]byte("{}"), data)
doReplyWithErr := func(w http.ResponseWriter) {
http.Error(w, "405 method not allowed", http.StatusMethodNotAllowed)
}
doReplyWithErr := func(w http.ResponseWriter) {
http.Error(w, "405 method not allowed", http.StatusMethodNotAllowed)
}
suite.xAppMgrFunc = doReplyWithErr
suite.xAppMgrFunc = doReplyWithErr
data, err := queryXAppsConfig("http://"+suite.listener.Addr().String()+"/test_url/", 1)
suite.Equal([]byte("{}"), data)
data, err := queryXAppsConfig("http://"+suite.listener.Addr().String()+"/test_url/", 1)
suite.Equal([]byte("{}"), data)
doReply := func(w http.ResponseWriter) {
fmt.Fprintf(w, "reply message")
}
doReply := func(w http.ResponseWriter) {
fmt.Fprintf(w, "reply message")
}
suite.xAppMgrFunc = doReply
suite.xAppMgrFunc = doReply
data, err := queryXAppsConfig("http://"+suite.listener.Addr().String()+"/test_url/", 1)
suite.NotNil(data)
data, err := queryXAppsConfig("http://"+suite.listener.Addr().String()+"/test_url/", 1)
suite.NotNil(data)