Skip to content

Commit 78c2148

Browse files
Add ConfirmedBy to Run (#1113)
* Added ConfirmedBy to Run struct as a valid relation * Updated CHANGELOG.md --------- Co-authored-by: jpadrianoGo <[email protected]>
1 parent 6d8c67f commit 78c2148

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Enhancements
44
* Adds `IngressAttributes` field to `PolicySetVersion` by @jpadrianoGo [#1092](https://github.com/hashicorp/go-tfe/pull/1092)
5+
* Adds `ConfirmedBy` field to `Run` by @jpadrianoGo [#1110](https://github.com/hashicorp/go-tfe/pull/1110)
56

67
# v1.80.0
78

run.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ type Run struct {
160160
ConfigurationVersion *ConfigurationVersion `jsonapi:"relation,configuration-version"`
161161
CostEstimate *CostEstimate `jsonapi:"relation,cost-estimate"`
162162
CreatedBy *User `jsonapi:"relation,created-by"`
163+
ConfirmedBy *User `jsonapi:"relation,confirmed-by"`
163164
Plan *Plan `jsonapi:"relation,plan"`
164165
PolicyChecks []*PolicyCheck `jsonapi:"relation,policy-checks"`
165166
TaskStages []*TaskStage `jsonapi:"relation,task-stages,omitempty"`

run_integration_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,33 @@ func TestRunsReadWithPolicyPaths(t *testing.T) {
446446
assert.Contains(t, r.PolicyPaths, "./foo")
447447
}
448448

449+
func TestRunsConfirmedBy(t *testing.T) {
450+
client := testClient(t)
451+
ctx := context.Background()
452+
453+
t.Run("with apply", func(t *testing.T) {
454+
rTest, rTestCleanup := createRunApply(t, client, nil)
455+
t.Cleanup(rTestCleanup)
456+
457+
r, err := client.Runs.Read(ctx, rTest.ID)
458+
require.NoError(t, err)
459+
460+
assert.NotNil(t, r.ConfirmedBy)
461+
assert.NotZero(t, r.ConfirmedBy.ID)
462+
})
463+
464+
t.Run("without apply", func(t *testing.T) {
465+
rTest, rTestCleanup := createPlannedRun(t, client, nil)
466+
t.Cleanup(rTestCleanup)
467+
468+
r, err := client.Runs.Read(ctx, rTest.ID)
469+
require.NoError(t, err)
470+
assert.Equal(t, rTest, r)
471+
472+
assert.Nil(t, r.ConfirmedBy)
473+
})
474+
}
475+
449476
func TestRunsApply(t *testing.T) {
450477
client := testClient(t)
451478
ctx := context.Background()

0 commit comments

Comments
 (0)