Skip to content

Commit

Permalink
test: enforce branch on test remote repository (knative#2540)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrangelramos authored Oct 12, 2024
1 parent e2621f6 commit b3b038b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/test-unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ jobs:
env:
FUNC_REPO_REF: ${{ github.event.pull_request.head.repo.full_name }}
FUNC_REPO_BRANCH_REF: ${{ github.head_ref }}
- name: Template Unit Tests on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
python3 -m venv ${{ github.workspace }}/.venv
. ${{ github.workspace }}/.venv/bin/activate
make test-templates
- name: Template Unit Tests
if: matrix.os != 'ubuntu-latest'
run: make test-templates
- name: "Archive code coverage results"
uses: actions/upload-artifact@v4
Expand Down
10 changes: 4 additions & 6 deletions test/oncluster/scenario_remote-repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"gotest.tools/v3/assert"
"knative.dev/func/test/common"
"knative.dev/func/test/testhttp"
)

func setupRemoteRepository(t *testing.T) (reposutoryUrl string) {
Expand Down Expand Up @@ -83,16 +82,15 @@ func TestRemoteRepository(t *testing.T) {
knFunc.Exec("create",
"--language", "go",
"--template", "testhello",
"--repository", gitRepoUrl,
"--repository", gitRepoUrl+"#main", // enforce branch to be used
funcPath)

knFunc.SourceDir = funcPath

knFunc.Exec("deploy", "--registry", common.GetRegistry())
knFunc.Exec("deploy", "--registry", common.GetRegistry(), "--remote")
defer knFunc.Exec("delete")
_, functionUrl := common.WaitForFunctionReady(t, funcName)

_, funcResponse := testhttp.TestGet(t, functionUrl)
assert.Assert(t, strings.Contains(funcResponse, "HELLO TEST"))
result := knFunc.Exec("invoke", "-p", funcPath)
assert.Assert(t, strings.Contains(result.Out, "HELLO TEST"))

}

0 comments on commit b3b038b

Please sign in to comment.