From 489fdd4f7c0189cc671d39cbf5a59dff5783b1b8 Mon Sep 17 00:00:00 2001 From: Cheuk Tse Date: Tue, 19 Aug 2025 15:46:32 -0400 Subject: [PATCH 1/5] workflow changes --- .github/workflows/test.yml | 306 ++++++++++++++++++------------------- 1 file changed, 153 insertions(+), 153 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c09e19f7477..c8c2a68ce5f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,82 +13,82 @@ env: MONGODB_TEST_OUTPUT_URI: ${{ secrets.MONGODB_TEST_OUTPUT_URI }} jobs: - test_go: - # note: we have automations that match on platform_name. be careful changing this. - name: ${{ matrix.platform_name }} Go Unit Tests - strategy: - fail-fast: false - matrix: - include: - - arch: ubuntu-large - image: ghcr.io/viamrobotics/rdk-devenv:amd64-cache - platform: linux/amd64 - platform_name: linux-amd64 - - arch: ubuntu-large-arm - image: ghcr.io/viamrobotics/rdk-devenv:arm64-cache - platform: linux/arm64 - platform_name: linux-arm64 - runs-on: ${{ matrix.arch }} - container: - image: ${{ matrix.image }} - options: --platform ${{ matrix.platform }} - timeout-minutes: 30 - - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.event.ref }} - - - name: Set main env vars - if: github.event_name != 'pull_request_target' - run: | - echo "GITHUB_X_HEAD_SHA=${GITHUB_SHA}" >> $GITHUB_ENV - echo "GITHUB_X_HEAD_REF=${GITHUB_REF_NAME}" >> $GITHUB_ENV - - - name: Set PR env vars - if: github.event_name == 'pull_request_target' - env: - GITHUB_HEAD_REF_SAN: ${{ github.event.pull_request.head.label }} - run: | - echo "GITHUB_X_HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV - echo "GITHUB_X_HEAD_REF=${GITHUB_HEAD_REF_SAN}" >> $GITHUB_ENV - echo "GITHUB_X_PR_BASE_SHA=${{ github.event.pull_request.base.sha }}" >> $GITHUB_ENV - echo "GITHUB_X_PR_BASE_REF=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV - - - name: Chown - run: chown -R testbot:testbot . - - - name: Run CLI linter tests - run: | - cd cli/internal/cli_lint - go build . - ./cli_lint ../../ - - - name: Verify no uncommitted changes from "make build-go lint-go generate-go" - run: | - sudo -Hu testbot bash -lc 'git init && git add . && make build-go lint-go generate-go' - GEN_DIFF=$(git status -s) - if [ -n "$GEN_DIFF" ]; then - echo '"make build-go lint-go generate-go" resulted in the following untracked changes:' 1>&2 - git diff - echo '"make build-go lint-go generate-go" resulted in changes not in git' 1>&2 - git status - exit 1 - fi - - - name: Run go unit tests - run: | - chmod -R a+rwx . # temporary fix for arm runners - sudo apt-get update && sudo apt-get install -y python3-venv - sudo --preserve-env=MONGODB_TEST_OUTPUT_URI,GITHUB_SHA,GITHUB_RUN_ID,GITHUB_RUN_NUMBER,GITHUB_RUN_ATTEMPT,GITHUB_X_PR_BASE_SHA,GITHUB_X_PR_BASE_REF,GITHUB_X_HEAD_REF,GITHUB_X_HEAD_SHA,GITHUB_REPOSITORY -Hu testbot bash -lc 'make test-go' - - - name: Upload test.json - if: always() - uses: actions/upload-artifact@v4 - with: - name: test-${{ matrix.platform_name }}.json - path: json.log - retention-days: 30 + # test_go: + # # note: we have automations that match on platform_name. be careful changing this. + # name: ${{ matrix.platform_name }} Go Unit Tests + # strategy: + # fail-fast: false + # matrix: + # include: + # - arch: ubuntu-large + # image: ghcr.io/viamrobotics/rdk-devenv:amd64-cache + # platform: linux/amd64 + # platform_name: linux-amd64 + # - arch: ubuntu-large-arm + # image: ghcr.io/viamrobotics/rdk-devenv:arm64-cache + # platform: linux/arm64 + # platform_name: linux-arm64 + # runs-on: ${{ matrix.arch }} + # container: + # image: ${{ matrix.image }} + # options: --platform ${{ matrix.platform }} + # timeout-minutes: 30 + + # steps: + # - uses: actions/checkout@v3 + # with: + # ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.event.ref }} + + # - name: Set main env vars + # if: github.event_name != 'pull_request_target' + # run: | + # echo "GITHUB_X_HEAD_SHA=${GITHUB_SHA}" >> $GITHUB_ENV + # echo "GITHUB_X_HEAD_REF=${GITHUB_REF_NAME}" >> $GITHUB_ENV + + # - name: Set PR env vars + # if: github.event_name == 'pull_request_target' + # env: + # GITHUB_HEAD_REF_SAN: ${{ github.event.pull_request.head.label }} + # run: | + # echo "GITHUB_X_HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV + # echo "GITHUB_X_HEAD_REF=${GITHUB_HEAD_REF_SAN}" >> $GITHUB_ENV + # echo "GITHUB_X_PR_BASE_SHA=${{ github.event.pull_request.base.sha }}" >> $GITHUB_ENV + # echo "GITHUB_X_PR_BASE_REF=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV + + # - name: Chown + # run: chown -R testbot:testbot . + + # - name: Run CLI linter tests + # run: | + # cd cli/internal/cli_lint + # go build . + # ./cli_lint ../../ + + # - name: Verify no uncommitted changes from "make build-go lint-go generate-go" + # run: | + # sudo -Hu testbot bash -lc 'git init && git add . && make build-go lint-go generate-go' + # GEN_DIFF=$(git status -s) + # if [ -n "$GEN_DIFF" ]; then + # echo '"make build-go lint-go generate-go" resulted in the following untracked changes:' 1>&2 + # git diff + # echo '"make build-go lint-go generate-go" resulted in changes not in git' 1>&2 + # git status + # exit 1 + # fi + + # - name: Run go unit tests + # run: | + # chmod -R a+rwx . # temporary fix for arm runners + # sudo apt-get update && sudo apt-get install -y python3-venv + # sudo --preserve-env=MONGODB_TEST_OUTPUT_URI,GITHUB_SHA,GITHUB_RUN_ID,GITHUB_RUN_NUMBER,GITHUB_RUN_ATTEMPT,GITHUB_X_PR_BASE_SHA,GITHUB_X_PR_BASE_REF,GITHUB_X_HEAD_REF,GITHUB_X_HEAD_SHA,GITHUB_REPOSITORY -Hu testbot bash -lc 'make test-go' + + # - name: Upload test.json + # if: always() + # uses: actions/upload-artifact@v4 + # with: + # name: test-${{ matrix.platform_name }}.json + # path: json.log + # retention-days: 30 test_win: name: windows @@ -105,7 +105,7 @@ jobs: GOFLAGS: "-tags=no_cgo" run: # note: this is a subset of tests that are known to pass on windows - go run gotest.tools/gotestsum --format standard-verbose --jsonfile json.log ./module ./logging/... + go run gotest.tools/gotestsum --format standard-verbose --jsonfile json.log ./web/server -run TestModulesRespondToDebugAndLogChanges -timeout 1m - name: Upload test.json if: always() @@ -115,79 +115,79 @@ jobs: path: json.log retention-days: 30 - test32: - name: Go 32-bit Unit Tests - runs-on: ubuntu-large-arm - timeout-minutes: 30 - - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref }} - - - uses: docker/login-action@v2 - with: - username: viambuild - password: ${{ secrets.DOCKER_PUBLIC_READONLY_PAT }} - - uses: docker/setup-qemu-action@v3 - - uses: docker/setup-buildx-action@v3 - - - name: Run go unit tests - run: | - chmod -R a+rwx . # temporary fix for arm runners - docker run \ - --platform linux/arm/v7 \ - -v `pwd`:/rdk \ - ghcr.io/viamrobotics/rdk-devenv:armhf-cache \ - sudo -Hu testbot bash -lc 'sudo apt-get update && sudo apt-get install -y python3-venv && cd /rdk && go test -v ./...' - - motion_tests: - name: Test Longer-running Motion Plans if affected - uses: viamrobotics/rdk/.github/workflows/motion-tests.yml@main - - jsonschema: - name: Test meta.json jsonschema - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - - uses: actions/setup-python@v5 - with: - cache-dependency-path: cli/test-requirements.txt - - run: | - go run -tags no_cgo ./cli/viam/ module create --local-only --name schematest --public-namespace ns - cat meta.json | jq '.models = [{"api": "x:y:z", "model": "x:y:z"}]' > meta2.json - python -m venv .venv - source .venv/bin/activate - pip install -r cli/test-requirements.txt - check-jsonschema --schemafile ./cli/module.schema.json meta2.json - - test_passing: - name: All Tests Passing - needs: [test_go, test32, motion_tests, test_win] - runs-on: [ubuntu-latest] - if: always() - steps: - - name: Check Results - run: | - echo Go Unit Tests: ${{ needs.test_go.result }} - echo Go 32-bit Tests: ${{ needs.test32.result }} - echo Windows Tests: ${{ needs.test_win.result }} - echo Motion Tests: ${{ needs.motion_tests.result }} - [ "${{ needs.test_go.result }}" == "success" ] && \ - [ "${{ needs.test32.result }}" == "success" ] && \ - [ "${{ needs.test_win.result }}" == "success" ] && \ - [ "${{ needs.motion_tests.result }}" == "success" ] - - # Now that RDK is public, can't directly comment without token having full read/write access - # code-coverage-comment.yml will trigger seperately and post the actual comments - - name: Prepare code comment - run: echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> pr.env - - - name: Mark appimage label - if: contains(github.event.pull_request.labels.*.name, 'appimage') || contains(github.event.pull_request.labels.*.name, 'appimage-ignore-tests') - run: echo "APPIMAGE=true" >> pr.env - - - name: Mark static label - if: contains(github.event.pull_request.labels.*.name, 'static-build') || contains(github.event.pull_request.labels.*.name, 'static-ignore-tests') - run: echo "STATIC=true" >> pr.env + # test32: + # name: Go 32-bit Unit Tests + # runs-on: ubuntu-large-arm + # timeout-minutes: 30 + + # steps: + # - uses: actions/checkout@v3 + # with: + # ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref }} + + # - uses: docker/login-action@v2 + # with: + # username: viambuild + # password: ${{ secrets.DOCKER_PUBLIC_READONLY_PAT }} + # - uses: docker/setup-qemu-action@v3 + # - uses: docker/setup-buildx-action@v3 + + # - name: Run go unit tests + # run: | + # chmod -R a+rwx . # temporary fix for arm runners + # docker run \ + # --platform linux/arm/v7 \ + # -v `pwd`:/rdk \ + # ghcr.io/viamrobotics/rdk-devenv:armhf-cache \ + # sudo -Hu testbot bash -lc 'sudo apt-get update && sudo apt-get install -y python3-venv && cd /rdk && go test -v ./...' + + # motion_tests: + # name: Test Longer-running Motion Plans if affected + # uses: viamrobotics/rdk/.github/workflows/motion-tests.yml@main + + # jsonschema: + # name: Test meta.json jsonschema + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/setup-go@v5 + # - uses: actions/setup-python@v5 + # with: + # cache-dependency-path: cli/test-requirements.txt + # - run: | + # go run -tags no_cgo ./cli/viam/ module create --local-only --name schematest --public-namespace ns + # cat meta.json | jq '.models = [{"api": "x:y:z", "model": "x:y:z"}]' > meta2.json + # python -m venv .venv + # source .venv/bin/activate + # pip install -r cli/test-requirements.txt + # check-jsonschema --schemafile ./cli/module.schema.json meta2.json + + # test_passing: + # name: All Tests Passing + # needs: [test_go, test32, motion_tests, test_win] + # runs-on: [ubuntu-latest] + # if: always() + # steps: + # - name: Check Results + # run: | + # echo Go Unit Tests: ${{ needs.test_go.result }} + # echo Go 32-bit Tests: ${{ needs.test32.result }} + # echo Windows Tests: ${{ needs.test_win.result }} + # echo Motion Tests: ${{ needs.motion_tests.result }} + # [ "${{ needs.test_go.result }}" == "success" ] && \ + # [ "${{ needs.test32.result }}" == "success" ] && \ + # [ "${{ needs.test_win.result }}" == "success" ] && \ + # [ "${{ needs.motion_tests.result }}" == "success" ] + + # # Now that RDK is public, can't directly comment without token having full read/write access + # # code-coverage-comment.yml will trigger seperately and post the actual comments + # - name: Prepare code comment + # run: echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> pr.env + + # - name: Mark appimage label + # if: contains(github.event.pull_request.labels.*.name, 'appimage') || contains(github.event.pull_request.labels.*.name, 'appimage-ignore-tests') + # run: echo "APPIMAGE=true" >> pr.env + + # - name: Mark static label + # if: contains(github.event.pull_request.labels.*.name, 'static-build') || contains(github.event.pull_request.labels.*.name, 'static-ignore-tests') + # run: echo "STATIC=true" >> pr.env From 290c027b9d5cf3a9d0578091b7e91a8e60cf4c7f Mon Sep 17 00:00:00 2001 From: Cheuk Tse Date: Tue, 19 Aug 2025 15:46:55 -0400 Subject: [PATCH 2/5] reenable test --- web/server/entrypoint_test.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/web/server/entrypoint_test.go b/web/server/entrypoint_test.go index 3452c2406f4..98a26f86647 100644 --- a/web/server/entrypoint_test.go +++ b/web/server/entrypoint_test.go @@ -555,9 +555,6 @@ func TestTunnelE2E(t *testing.T) { } func TestModulesRespondToDebugAndLogChanges(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("RSDK-11682: get this to stop flaking on win") - } // Primarily a regression test for RSDK-10723. logger := logging.NewTestLogger(t) From f8b5c455cafa264de03382162e127114c28e6e36 Mon Sep 17 00:00:00 2001 From: Cheuk Tse Date: Tue, 19 Aug 2025 15:58:23 -0400 Subject: [PATCH 3/5] try --- module/modmanager/module.go | 2 +- robot/jobmanager/jobmanager.go | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/module/modmanager/module.go b/module/modmanager/module.go index df35afed534..0fcc7eab227 100644 --- a/module/modmanager/module.go +++ b/module/modmanager/module.go @@ -121,7 +121,7 @@ func (m *module) checkReady(ctx context.Context, parentAddr string) error { for { // 5000 is an arbitrarily high number of attempts (context timeout should hit long before) - resp, err := m.client.Ready(ctxTimeout, req, grpc_retry.WithMax(5000)) + resp, err := m.client.Ready(ctxTimeout, req, grpc_retry.WithMax(5000), grpc_retry.WithPerRetryTimeout(5*time.Second)) if err != nil { return err } diff --git a/robot/jobmanager/jobmanager.go b/robot/jobmanager/jobmanager.go index 1d2a73f5e36..5f5d7d1fce3 100644 --- a/robot/jobmanager/jobmanager.go +++ b/robot/jobmanager/jobmanager.go @@ -79,7 +79,15 @@ func New( if rutils.ViamTCPSockets() { dialAddr = parentAddr.TCPAddr } - conn, err := grpc.Dial(robotContext, dialAddr, jobLogger) + var conn rpc.ClientConn + for range 4 { + dialCtx, cancel := context.WithTimeout(robotContext, 5*time.Second) + conn, err = grpc.Dial(dialCtx, dialAddr, jobLogger) + cancel() + if err == nil { + break + } + } if err != nil { return nil, err } From c3aa0a583d35a6c1667c43ab6edbae632badb694 Mon Sep 17 00:00:00 2001 From: Cheuk Tse Date: Tue, 19 Aug 2025 16:16:00 -0400 Subject: [PATCH 4/5] lower timeout --- utils/env.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/env.go b/utils/env.go index 44caff80bf7..5c3dfefa74d 100644 --- a/utils/env.go +++ b/utils/env.go @@ -24,7 +24,7 @@ const ( ResourceConfigurationTimeoutEnvVar = "VIAM_RESOURCE_CONFIGURATION_TIMEOUT" // DefaultModuleStartupTimeout is the default module startup timeout. - DefaultModuleStartupTimeout = 5 * time.Minute + DefaultModuleStartupTimeout = 45 * time.Second // ModuleStartupTimeoutEnvVar is the environment variable that can // be set to override DefaultModuleStartupTimeout as the duration From 2c910b0a7c580fa1356e0735ededdd193cb849ab Mon Sep 17 00:00:00 2001 From: Cheuk Tse Date: Tue, 19 Aug 2025 16:24:32 -0400 Subject: [PATCH 5/5] lower timeout --- utils/env.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/env.go b/utils/env.go index 5c3dfefa74d..350588f273e 100644 --- a/utils/env.go +++ b/utils/env.go @@ -24,7 +24,7 @@ const ( ResourceConfigurationTimeoutEnvVar = "VIAM_RESOURCE_CONFIGURATION_TIMEOUT" // DefaultModuleStartupTimeout is the default module startup timeout. - DefaultModuleStartupTimeout = 45 * time.Second + DefaultModuleStartupTimeout = 20 * time.Second // ModuleStartupTimeoutEnvVar is the environment variable that can // be set to override DefaultModuleStartupTimeout as the duration