validation: async()

in wrappers/executors/fluent-bit-executor.ts [469:506]


            validation: async (root: IBuiltStage, subtree: IBuiltStage) => {

                const signalHandler = async () => {
                    return new Promise((promiseResolve) => {

                        /* request shutdown: SigTerm */
                        logger.info("Fluent Bit signalled");
                        fluentBitChildProcess.kill('SIGTERM');

                        /* terminate after grace: SigInt */
                        let graceTimer = setTimeout(() => {
                            fluentBitChildProcess.kill('SIGKILL');
                            logger.info("Fluent Bit killed");
                            graceTimer = null;
                        }, config.grace * 1000);

                        /* handle exit */
                        fluentBitChildProcess.on("close", () => {
                            if (graceTimer) {
                                clearTimeout(graceTimer);
                            }
                            logger.info("Fluent Bit exited (stopped)");
                            promiseResolve(null);
                        });
                    });
                };

                await signalHandler();
                return {
                    isValidationSuccess: true,
                    // Other data can be added here for validation metric collection.
                    validationData: {
                        fluentLogCounts: fluentLogCounts,
                        /*fluentBitProcessLogger: fluentBitProcessLogger, */
                    },
                    /* May want to add hidden validation data */
                };
            },