Test include: more recent log dates

pull/265/head
Frostebite 2021-05-28 20:29:08 +01:00
parent 0ae8dc9a20
commit bec61120bd
3 changed files with 9 additions and 9 deletions

8
dist/index.js vendored
View File

@ -1036,7 +1036,7 @@ class Kubernetes {
return __awaiter(this, void 0, void 0, function* () {
try {
let running = true;
let logQueryTime = 999;
let mostRecentLogTime = 999;
let mostRecentLine = '';
while (running) {
const pod = yield this.kubeClient.readNamespacedPod(name, namespace);
@ -1045,7 +1045,7 @@ class Kubernetes {
core.info('Polling logs...');
let logs;
try {
logs = yield this.kubeClient.readNamespacedPodLog(name, namespace, undefined, undefined, undefined, undefined, undefined, undefined, logQueryTime, undefined, true);
logs = yield this.kubeClient.readNamespacedPodLog(name, namespace, undefined, undefined, undefined, undefined, undefined, undefined, mostRecentLogTime, undefined, true);
}
catch (error) {
core.info(error);
@ -1060,9 +1060,9 @@ class Kubernetes {
const [time, ...line] = element.split(' ');
const lineString = line.join(' ');
const lineDate = Date.parse(time);
if (mostRecentLine !== lineString || lineDate !== logQueryTime) {
if (mostRecentLine !== lineString || lineDate > mostRecentLogTime) {
core.info(lineString);
logQueryTime = lineDate;
mostRecentLogTime = lineDate;
mostRecentLine = lineString;
}
else {

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -319,7 +319,7 @@ class Kubernetes {
static async streamLogs(name: string, namespace: string) {
try {
let running = true;
let logQueryTime: number = 999;
let mostRecentLogTime: number = 999;
let mostRecentLine: string = '';
while (running) {
const pod = await this.kubeClient.readNamespacedPod(name, namespace);
@ -337,7 +337,7 @@ class Kubernetes {
undefined,
undefined,
undefined,
logQueryTime,
mostRecentLogTime,
undefined,
true,
);
@ -354,9 +354,9 @@ class Kubernetes {
const [time, ...line] = element.split(' ');
const lineString: string = line.join(' ');
const lineDate: number = Date.parse(time);
if (mostRecentLine !== lineString || lineDate !== logQueryTime) {
if (mostRecentLine !== lineString || lineDate > mostRecentLogTime) {
core.info(lineString);
logQueryTime = lineDate;
mostRecentLogTime = lineDate;
mostRecentLine = lineString;
} else {
break;