@@ -64,6 +64,27 @@ func TestAgentPoolsList(t *testing.T) {
64
64
assert .Equal (t , 1 , pools .TotalCount )
65
65
})
66
66
67
+ t .Run ("with sorting" , func (t * testing.T ) {
68
+ agentPool2 , agentPoolCleanup2 := createAgentPool (t , client , orgTest )
69
+ t .Cleanup (agentPoolCleanup2 )
70
+
71
+ pools , err := client .AgentPools .List (ctx , orgTest .Name , & AgentPoolListOptions {
72
+ Sort : "created-at" ,
73
+ })
74
+ require .NoError (t , err )
75
+ require .NotNil (t , pools )
76
+ require .Len (t , pools .Items , 2 )
77
+ require .Equal (t , []string {agentPool .ID , agentPool2 .ID }, []string {pools .Items [0 ].ID , pools .Items [1 ].ID })
78
+
79
+ pools , err = client .AgentPools .List (ctx , orgTest .Name , & AgentPoolListOptions {
80
+ Sort : "-created-at" ,
81
+ })
82
+ require .NoError (t , err )
83
+ require .NotNil (t , pools )
84
+ require .Len (t , pools .Items , 2 )
85
+ require .Equal (t , []string {agentPool2 .ID , agentPool .ID }, []string {pools .Items [0 ].ID , pools .Items [1 ].ID })
86
+ })
87
+
67
88
t .Run ("without a valid organization" , func (t * testing.T ) {
68
89
pools , err := client .AgentPools .List (ctx , badIdentifier , nil )
69
90
assert .Nil (t , pools )
0 commit comments