diff --git a/cnf-certification-test/tnf_config.yml b/cnf-certification-test/tnf_config.yml index 847c704d1..ccd897afb 100644 --- a/cnf-certification-test/tnf_config.yml +++ b/cnf-certification-test/tnf_config.yml @@ -1,5 +1,5 @@ targetNameSpaces: - - name: jmontesi + - name: tnf podsUnderTestLabels: - "test-network-function.com/generic: target" # deprecated operator label ("test-network-function.com/operator:"") still configured by default, no need to add it here diff --git a/internal/log/log.go b/internal/log/log.go index b750ba02d..b27baa615 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -10,9 +10,10 @@ import ( "time" ) -type Logger struct { - *slog.Logger -} +const ( + LogFileName = "cnf-certsuite.log" + LogFilePermissions = 0o644 +) var logger *slog.Logger diff --git a/main.go b/main.go index 26b205d9a..7293ace4d 100644 --- a/main.go +++ b/main.go @@ -38,8 +38,6 @@ const ( junitFlagKey = "junit" TNFReportKey = "cnf-certification-test" extraInfoKey = "testsExtraInfo" - logFileName = "cnf-certsuite.log" - logFilePermissions = 0o644 ) func init() { @@ -47,13 +45,13 @@ func init() { } func createLogFile(outputDir string) (*os.File, error) { - logFilePath := outputDir + "/" + logFileName + logFilePath := outputDir + "/" + log.LogFileName err := os.Remove(logFilePath) if err != nil && !os.IsNotExist(err) { return nil, fmt.Errorf("could not delete old log file, err: %v", err) } - logFile, err := os.OpenFile(logFilePath, os.O_RDWR|os.O_CREATE, logFilePermissions) + logFile, err := os.OpenFile(logFilePath, os.O_RDWR|os.O_CREATE, log.LogFilePermissions) if err != nil { return nil, fmt.Errorf("could not open a new log file, err: %v", err) } @@ -68,7 +66,7 @@ func setupLogger(logFile *os.File) { } log.SetupLogger(logFile, logLevel) - log.Info("Log file: %s (level=%s)", logFileName, logLevel.String()) + log.Info("Log file: %s (level=%s)", log.LogFileName, logLevel.String()) } func main() { @@ -97,7 +95,7 @@ func main() { fmt.Printf("Claim file version: %s\n", versions.ClaimFormatVersion) fmt.Printf("Checks filter: %s\n", *flags.LabelsFlag) fmt.Printf("Output folder: %s\n", *flags.ClaimPath) - fmt.Printf("Log file: %s\n", logFileName) + fmt.Printf("Log file: %s\n", log.LogFileName) fmt.Printf("\n") if *flags.ListFlag { diff --git a/pkg/certsuite/certsuite.go b/pkg/certsuite/certsuite.go index 21098ad37..5c52670db 100644 --- a/pkg/certsuite/certsuite.go +++ b/pkg/certsuite/certsuite.go @@ -138,6 +138,9 @@ func Run(labelsFilter, outputFolder string) { // Add all the web artifacts file paths. allArtifactsFilePaths = append(allArtifactsFilePaths, webFilePaths...) + // Add the log file path + allArtifactsFilePaths = append(allArtifactsFilePaths, filepath.Join(outputFolder, log.LogFileName)) + // tar.gz file creation with results and html artifacts, unless omitted by env var. if !configuration.GetTestParameters().OmitArtifactsZipFile { err = results.CompressResultsArtifacts(resultsOutputDir, allArtifactsFilePaths)