From 603c8a49190adbb5ed87726e140720c56ebc162e Mon Sep 17 00:00:00 2001 From: Lifailon Date: Thu, 27 Feb 2025 01:18:01 +0300 Subject: [PATCH] add upload markdown report to wiki and remove pcap test --- .github/workflows/build.yml | 21 +++++++++++++++++++-- main_test.go | 35 ++--------------------------------- 2 files changed, 21 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e696a83..ab0e1a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,7 +36,7 @@ jobs: runs-on: ${{ github.event.inputs.Distro }} steps: - - name: Clone repository + - name: Clone main repository uses: actions/checkout@v4 - name: Install Go @@ -75,7 +75,7 @@ jobs: go install github.com/securego/gosec/v2/cmd/gosec@latest gosec -severity=high ./... - - name: Start Docker container for test in Ubuntu + - name: Start docker container for test in Ubuntu if: ${{ (github.event.inputs.testFunctions == 'true' && github.event.inputs.Distro != 'macos-15') || (github.event.inputs.testInterface == 'true' && github.event.inputs.Distro != 'macos-15') @@ -101,6 +101,23 @@ jobs: amend: true continue-on-error: true + - name: Clone wiki repository + run: | + git clone https://github.com/${{ github.repository }}.wiki.git wiki + cd wiki + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + continue-on-error: true + + - name: Upload markdown report to Wiki + run: | + cp test-report.md wiki/Test-functions-report.md + cd wiki + git add Test-functions-report.md + git commit -m "update test functions report" + git push + continue-on-error: true + - name: Install TMUX for macOS if: ${{ github.event.inputs.testInterface == 'true' && github.event.inputs.Distro == 'macos-15' }} run: brew install tmux diff --git a/main_test.go b/main_test.go index bdf3286..7c6e91b 100644 --- a/main_test.go +++ b/main_test.go @@ -2,7 +2,6 @@ package main import ( "bufio" - "compress/gzip" "fmt" "log" "os" @@ -175,36 +174,6 @@ func TestUnixFiles(t *testing.T) { file.WriteString("| Path | Lines | Read | Color |\n") file.WriteString("|------|-------|------|-------|\n") - // Создаем временный pcap файл - pcapFile := "test.pcap" - gzipFile := "test.pcap.gz" - file, err := os.Create(pcapFile) - if err != nil { - t.Fatal(err) - } - // Удаляем после теста - defer os.Remove(pcapFile) - defer file.Close() - // Минимальный заголовок, чтобы tcpdump понимал формат - pcapHeader := []byte{0xd4, 0xc3, 0xb2, 0xa1, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - file.Write(pcapHeader) - // Создаем gzip из pcap файла - original, err := os.Open(pcapFile) - if err != nil { - t.Fatal(err) - } - defer original.Close() - gzFile, err := os.Create(gzipFile) - if err != nil { - t.Fatal(err) - } - defer os.Remove(gzipFile) - defer gzFile.Close() - gzWriter := gzip.NewWriter(gzFile) - defer gzWriter.Close() - // Копируем содержимое pcap в gzip - gzWriter.Write(pcapHeader) - testCases := []struct { name string selectPath string @@ -450,7 +419,7 @@ func TestFilterColor(t *testing.T) { "11 line: null success complete accept connection finish started created enable allowing posted", "12 line: routing forward passed running added opened patching ok available accessible done true", "13 line: stdout input GET SET head request upload listen launch change clear skip missing mount", - "14 line: authorization configuration options option writing saving booting boot paused filter normal notice alert", + "14 line: authorization configuration option writing saving boot paused filter normal notice alert", "15 line: information update shutdown status debug verbose trace protocol level", "16 line: 2025-02-26T21:38:35.956968+03:00 ⎯⎯⎯ 0x04 ⎯⎯⎯", "17 line: 25.02.2025 11:11 11:11:11:11:11:11 11-11-11-11-11-11", @@ -654,7 +623,7 @@ func TestMockInterface(t *testing.T) { "11 line: null success complete accept connection finish started created enable allowing posted", "12 line: routing forward passed running added opened patching ok available accessible done true", "13 line: stdout input GET SET head request upload listen launch change clear skip missing mount", - "14 line: authorization configuration options option writing saving booting boot paused filter normal notice alert", + "14 line: authorization configuration option writing saving boot paused filter normal notice alert", "15 line: information update shutdown status debug verbose trace protocol level", "16 line: 2025-02-26T21:38:35.956968+03:00 ⎯⎯⎯ 0x04 ⎯⎯⎯", "17 line: 25.02.2025 11:11 11:11:11:11:11:11 11-11-11-11-11-11",