From e52d60c714f3f71c387cbae8274454e4571bcc7b Mon Sep 17 00:00:00 2001 From: Mike Nguyen Date: Wed, 20 Nov 2024 16:09:32 +0000 Subject: [PATCH] ci: remove runtime version override (#642) * ci: remove runtime version override Signed-off-by: mikeee * fix: remove base64 decode for jobs api example Signed-off-by: mikeee * fix(tests): update jobs api test Signed-off-by: mikeee --------- Signed-off-by: mikeee Co-authored-by: Yaron Schneider --- .github/workflows/validate_examples.yaml | 2 +- examples/dist-scheduler/README.md | 6 +++--- examples/dist-scheduler/main.go | 13 ++----------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/.github/workflows/validate_examples.yaml b/.github/workflows/validate_examples.yaml index cc627998..ddf12530 100644 --- a/.github/workflows/validate_examples.yaml +++ b/.github/workflows/validate_examples.yaml @@ -40,7 +40,7 @@ jobs: DAPR_INSTALL_URL: ${{ env.DAPR_INSTALL_URL }} DAPR_CLI_VER: ${{ steps.outputs.outputs.DAPR_CLI_VER }} DAPR_CLI_REF: ${{ steps.outputs.outputs.DAPR_CLI_REF }} - DAPR_RUNTIME_VER: 1.14.1 + DAPR_RUNTIME_VER: ${{ steps.outputs.outputs.DAPR_RUNTIME_VER }} CHECKOUT_REPO: ${{ steps.outputs.outputs.CHECKOUT_REPO }} CHECKOUT_REF: ${{ steps.outputs.outputs.CHECKOUT_REF }} DAPR_REF: ${{ steps.outputs.outputs.DAPR_REF }} diff --git a/examples/dist-scheduler/README.md b/examples/dist-scheduler/README.md index 81baec8f..83cd2dc0 100644 --- a/examples/dist-scheduler/README.md +++ b/examples/dist-scheduler/README.md @@ -15,11 +15,11 @@ expected_stdout_lines: - 'Scheduler stream connected' - 'schedulejob - success' - 'job 0 received' - - 'extracted payload: {db-backup {my-prod-db /backup-dir}}' + - 'payload: {db-backup {my-prod-db /backup-dir}}' - 'job 1 received' - - 'extracted payload: {db-backup {my-prod-db /backup-dir}}' + - 'payload: {db-backup {my-prod-db /backup-dir}}' - 'job 2 received' - - 'extracted payload: {db-backup {my-prod-db /backup-dir}}' + - 'payload: {db-backup {my-prod-db /backup-dir}}' - 'getjob - resp: &{prod-db-backup @every 1s 10 value:"{\"task\":\"db-backup\",\"metadata\":{\"db_name\":\"my-prod-db\",\"backup_location\":\"/backup-dir\"}}"}' - 'deletejob - success' diff --git a/examples/dist-scheduler/main.go b/examples/dist-scheduler/main.go index a062b7ad..cd7aa32f 100644 --- a/examples/dist-scheduler/main.go +++ b/examples/dist-scheduler/main.go @@ -2,7 +2,6 @@ package main import ( "context" - "encoding/base64" "encoding/json" "fmt" "log" @@ -96,19 +95,11 @@ func main() { var jobCount = 0 func prodDBBackupHandler(ctx context.Context, job *common.JobEvent) error { - var jobData common.Job - if err := json.Unmarshal(job.Data, &jobData); err != nil { - return fmt.Errorf("failed to unmarshal job: %v", err) - } - decodedPayload, err := base64.StdEncoding.DecodeString(jobData.Value) - if err != nil { - return fmt.Errorf("failed to decode job payload: %v", err) - } var jobPayload api.DBBackup - if err := json.Unmarshal(decodedPayload, &jobPayload); err != nil { + if err := json.Unmarshal(job.Data, &jobPayload); err != nil { return fmt.Errorf("failed to unmarshal payload: %v", err) } - fmt.Printf("job %d received:\n type: %v \n typeurl: %v\n value: %v\n extracted payload: %v\n", jobCount, job.JobType, jobData.TypeURL, jobData.Value, jobPayload) + fmt.Printf("job %d received:\n type: %v \n payload: %v\n", jobCount, job.JobType, jobPayload) jobCount++ return nil }