tests: Fix missing log on TDX

Currently, we have found that `assert_logs_contain` does not work on TDX.
We manually located the specific log, but it fails to get the log using `kubectl debug`. The error found in CI is:
```
warning: couldn't attach to pod/node-debugger-984fee00bd70.jf.intel.com-pdgsj,
falling back to streaming logs: error stream protocol error: unknown error
```

Upon debugging the TDX CI machine, we found an error in containerd:
```
Attach container from runtime service failed" err="rpc error: code = InvalidArgument desc = tty and stderr cannot both be true"
containerID="abc8c7a546c5fede4aae53a6ff2f4382ff35da331bfc5fd3843b0c8b231728bf"
```

We believe this is the root cause of the test failures in TDX CI.
Therefore, we need to ensure that tty and stderr are not set to true at same time.

Fixes: #10011

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
Signed-off-by: Wang, Arron <arron.wang@intel.com>
This commit is contained in:
ChengyuZhu6 2024-07-18 15:33:46 +08:00
parent 5ce2c1010a
commit 3476fb481e

View File

@ -77,8 +77,7 @@ assert_logs_contain() {
local message="$4"
# Note: with image-rs we get more than the default 1000 lines of logs
print_node_journal "$node" "$log_id" --since "$datetime" -n 100000 \
| grep "$message"
print_node_journal "$node" "$log_id" --since "$datetime" | grep "$message"
}
# Create a pod then assert it fails to run. Use in tests that you expect the
@ -241,7 +240,7 @@ print_node_journal() {
shift 2
local img="quay.io/prometheus/busybox"
kubectl debug --image "$img" -q -it "node/${node}" \
kubectl debug --image "$img" -q -i "node/${node}" \
-- chroot /host journalctl -x -t "$id" --no-pager "$@"
# Delete the debugger pod
kubectl get pods -o name | grep "node-debugger-${node}" | \