mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-02-18 04:15:15 +00:00
Fix agent updating (#3287)
This commit is contained in:
parent
94b882fb95
commit
2eec1ce909
2 changed files with 20 additions and 1 deletions
|
@ -25,7 +25,7 @@ type Agent struct {
|
||||||
Platform string `json:"platform" xorm:"VARCHAR(100) 'platform'"`
|
Platform string `json:"platform" xorm:"VARCHAR(100) 'platform'"`
|
||||||
Backend string `json:"backend" xorm:"VARCHAR(100) 'backend'"`
|
Backend string `json:"backend" xorm:"VARCHAR(100) 'backend'"`
|
||||||
Capacity int32 `json:"capacity" xorm:"capacity"`
|
Capacity int32 `json:"capacity" xorm:"capacity"`
|
||||||
Version string `json:"version" xorm:"version"`
|
Version string `json:"version" xorm:"'version'"`
|
||||||
NoSchedule bool `json:"no_schedule" xorm:"no_schedule"`
|
NoSchedule bool `json:"no_schedule" xorm:"no_schedule"`
|
||||||
} // @name Agent
|
} // @name Agent
|
||||||
|
|
||||||
|
|
|
@ -87,3 +87,22 @@ func TestAgentList(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, 1, len(agents))
|
assert.Equal(t, 1, len(agents))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAgentUpdate(t *testing.T) {
|
||||||
|
store, closer := newTestStore(t, new(model.Agent))
|
||||||
|
defer closer()
|
||||||
|
|
||||||
|
agent := &model.Agent{
|
||||||
|
ID: int64(1),
|
||||||
|
Name: "test",
|
||||||
|
Token: "secret-token",
|
||||||
|
}
|
||||||
|
err := store.AgentCreate(agent)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
agent.Backend = "local"
|
||||||
|
agent.Capacity = 2
|
||||||
|
agent.Version = "next-abcdef"
|
||||||
|
err = store.AgentUpdate(agent)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue