Skip to content

Commit

Permalink
create folder before e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyulin0719 committed Jan 3, 2024
1 parent 565bc7b commit d2d370d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,16 @@ jobs:
key: ${{ runner.os }}-e2e-${{ hashFiles('Makefile') }}
restore-keys: |
${{ runner.os }}-e2e-
- name: Create artifacts stage folder
run: mkdir -p /tmp/artifacts
- run: ./scripts/run-e2e-tests.sh -a "test" -n "yk8s" -v "kindest/node:${KIND_NODE_IMAGE}" ${KIND_EXTRA_ARGS}
env:
KIND_NODE_IMAGE: ${{ matrix.k8s }}
KIND_EXTRA_ARGS: ${{ matrix.plugin }}
- run: mkdir -p /tmp/artifacts
if: ${{ failure() }}
- run: echo hello > /tmp/artifacts/world.txt
if: ${{ failure() }}
- uses: actions/upload-artifact@v4
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: ${{ github.job }} stdout (${{ matrix.k8s }}${{ matrix.plugin == '' && '' || format(', {0}', matrix.plugin) }})
Expand Down
8 changes: 3 additions & 5 deletions test/e2e/gang_scheduling/gang_scheduling_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
"testing"

"github.com/onsi/ginkgo/v2"
"github.com/onsi/ginkgo/v2/reporters"

// "github.com/onsi/ginkgo/v2/internal"
"github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"

Expand Down Expand Up @@ -64,12 +62,12 @@ var kClient = k8s.KubeCtl{} //nolint

var _ = BeforeSuite(func() {
// Create a local file for suite stdout output
_, filename, _, _ := runtime.Caller(0)
package_name := filepath.Base(filepath.Dir(filename))
file, err := os.Create("/tmp/artifacts/" + package_name + ".txt")
suite_name := "gangscheduling_test"
file, err := os.Create("/tmp/artifacts/" + suite_name + ".txt")
if err != nil {
ginkgo.Fail(fmt.Sprintf("Failed to create file: %v", err))
}
// change from stdout to file
writer := ginkgo_writer.NewWriter(file)
ginkgo.GinkgoWriter = writer
// ginkgo.GinkgoLogr = ginkgo_writer.GinkgoLogrFunc(writer)
Expand Down

0 comments on commit d2d370d

Please sign in to comment.