Skip to content

Commit

Permalink
fix grpc parsing in test
Browse files Browse the repository at this point in the history
  • Loading branch information
VenelinMartinov committed Sep 6, 2024
1 parent 1170bd9 commit 3532882
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pf/tests/schema_and_program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tfbridgetests

import (
"context"
"encoding/json"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -138,11 +139,14 @@ resources:
res := pt.Preview(optpreview.Diff())
t.Log(res.StdOut)

diffs, err := pt.GrpcLog().Diffs()
require.NoError(t, err)

assert.Len(t, diffs, 1)
assert.Equal(t, "DIFF_SOME", diffs[0].Response.Changes.String())
for _, entry := range pt.GrpcLog().Entries {
if entry.Method == "/pulumirpc.ResourceProvider/Diff" {
var diff map[string]interface{}
err := json.Unmarshal(entry.Response, &diff)
require.NoError(t, err)
assert.Equal(t, "DIFF_SOME", diff["changes"])
}
}
}

func TestIDAttribute(t *testing.T) {
Expand Down

0 comments on commit 3532882

Please sign in to comment.