diff --git a/daemon/logger/crilog/log.go b/daemon/logger/crilog/log.go index 1fc61bfa7..6140747f4 100644 --- a/daemon/logger/crilog/log.go +++ b/daemon/logger/crilog/log.go @@ -125,26 +125,36 @@ func redirectLogs(path string, w io.Writer, r io.ReadCloser, stream streamType) partialBytes := []byte(runtime.LogTagPartial) fullBytes := []byte(runtime.LogTagFull) br := bufio.NewReaderSize(r, bufSize) + stop := false + for { - lineBytes, isPrefix, err := br.ReadLine() + lineBytes, err := br.ReadBytes(eol) + tagBytes := fullBytes if err != nil { - if err == io.EOF { - logrus.Infof("finish redirecting log file(name=%v)", path) - } else { + if err != io.EOF { logrus.WithError(err).Errorf("failed to redirect log file(name=%v)", path) + return } - return - } - tagBytes := fullBytes - if isPrefix { + logrus.Infof("finish redirecting log file(name=%v)", path) + + if len(lineBytes) == 0 { + return + } + + // the last line without the eol is treated as a partial log. tagBytes = partialBytes + stop = true } + timestampBytes := time.Now().AppendFormat(nil, time.RFC3339Nano) data := bytes.Join([][]byte{timestampBytes, streamBytes, tagBytes, lineBytes}, delimiterBytes) - data = append(data, eol) if _, err := w.Write(data); err != nil { logrus.Errorf("failed to write %q log to log file: %v", stream, err) } + + if stop { + break + } } } diff --git a/hack/install/install_critest.sh b/hack/install/install_critest.sh index 450e37c01..9723c191b 100755 --- a/hack/install/install_critest.sh +++ b/hack/install/install_critest.sh @@ -2,7 +2,7 @@ set -euo pipefail -CRITEST_BRANCH_DEFAULT=release-1.12 +CRITEST_BRANCH_DEFAULT=master # keep the first one only GOPATH="${GOPATH%%:*}" diff --git a/hack/testing/run_daemon_cri_e2e.sh b/hack/testing/run_daemon_cri_e2e.sh index bdba4c5ce..229b709ed 100755 --- a/hack/testing/run_daemon_cri_e2e.sh +++ b/hack/testing/run_daemon_cri_e2e.sh @@ -58,10 +58,10 @@ integration::run_daemon_cri_test_e2e_cases() { local cri_runtime code KUBERNETES_VERSION cri_runtime=$1 - KUBERNETES_VERSION="release-1.12" + KUBERNETES_VERSION="release-1.14" KUBERNETES_REPO="github.com/kubernetes/kubernetes" KUBERNETES_PATH="${GOPATH}/src/k8s.io/kubernetes" - if [ ! -d "${KUBERNETES_PATH}" ]; then + if [[ ! -d "${KUBERNETES_PATH}" ]]; then mkdir -p "${KUBERNETES_PATH}" cd "${KUBERNETES_PATH}" git clone https://${KUBERNETES_REPO} . diff --git a/hack/testing/run_daemon_cri_integration.sh b/hack/testing/run_daemon_cri_integration.sh index 02596c78b..5afcc9e01 100755 --- a/hack/testing/run_daemon_cri_integration.sh +++ b/hack/testing/run_daemon_cri_integration.sh @@ -19,6 +19,7 @@ export PATH="${GOPATH}/bin:${PATH}" # CRI_SKIP skips the test to skip. DEFAULT_CRI_SKIP="should error on create with wrong options" +DEFAULT_CRI_SKIP+="|runtime should support execSync with timeout" CRI_SKIP="${CRI_SKIP:-"${DEFAULT_CRI_SKIP}"}" # CRI_FOCUS focuses the test to run.