mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
Merge pull request #1871 from derekwaynecarr/handle_container_logs_on_alternate_namespace
handleContainerLogs needs a namespace to address a pod
This commit is contained in:
@@ -470,8 +470,9 @@ func TestServeRunInContainerWithUUID(t *testing.T) {
|
||||
func TestContainerLogs(t *testing.T) {
|
||||
fw := newServerTest()
|
||||
output := "foo bar"
|
||||
podNamespace := "other"
|
||||
podName := "foo"
|
||||
expectedPodName := podName + ".default.etcd"
|
||||
expectedPodName := podName + ".other.etcd"
|
||||
expectedContainerName := "baz"
|
||||
expectedTail := ""
|
||||
expectedFollow := false
|
||||
@@ -490,7 +491,7 @@ func TestContainerLogs(t *testing.T) {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
resp, err := http.Get(fw.testHTTPServer.URL + "/containerLogs/" + podName + "/" + expectedContainerName)
|
||||
resp, err := http.Get(fw.testHTTPServer.URL + "/containerLogs/" + podNamespace + "/" + podName + "/" + expectedContainerName)
|
||||
if err != nil {
|
||||
t.Errorf("Got error GETing: %v", err)
|
||||
}
|
||||
@@ -509,8 +510,9 @@ func TestContainerLogs(t *testing.T) {
|
||||
func TestContainerLogsWithTail(t *testing.T) {
|
||||
fw := newServerTest()
|
||||
output := "foo bar"
|
||||
podNamespace := "other"
|
||||
podName := "foo"
|
||||
expectedPodName := podName + ".default.etcd"
|
||||
expectedPodName := podName + ".other.etcd"
|
||||
expectedContainerName := "baz"
|
||||
expectedTail := "5"
|
||||
expectedFollow := false
|
||||
@@ -529,7 +531,7 @@ func TestContainerLogsWithTail(t *testing.T) {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
resp, err := http.Get(fw.testHTTPServer.URL + "/containerLogs/" + podName + "/" + expectedContainerName + "?tail=5")
|
||||
resp, err := http.Get(fw.testHTTPServer.URL + "/containerLogs/" + podNamespace + "/" + podName + "/" + expectedContainerName + "?tail=5")
|
||||
if err != nil {
|
||||
t.Errorf("Got error GETing: %v", err)
|
||||
}
|
||||
@@ -548,8 +550,9 @@ func TestContainerLogsWithTail(t *testing.T) {
|
||||
func TestContainerLogsWithFollow(t *testing.T) {
|
||||
fw := newServerTest()
|
||||
output := "foo bar"
|
||||
podNamespace := "other"
|
||||
podName := "foo"
|
||||
expectedPodName := podName + ".default.etcd"
|
||||
expectedPodName := podName + ".other.etcd"
|
||||
expectedContainerName := "baz"
|
||||
expectedTail := ""
|
||||
expectedFollow := true
|
||||
@@ -568,7 +571,7 @@ func TestContainerLogsWithFollow(t *testing.T) {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
resp, err := http.Get(fw.testHTTPServer.URL + "/containerLogs/" + podName + "/" + expectedContainerName + "?follow=1")
|
||||
resp, err := http.Get(fw.testHTTPServer.URL + "/containerLogs/" + podNamespace + "/" + podName + "/" + expectedContainerName + "?follow=1")
|
||||
if err != nil {
|
||||
t.Errorf("Got error GETing: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user