Rename OPKGUpdate() to Update()

This commit is contained in:
wpetit 2018-09-19 17:24:50 +02:00
parent 2d0c3d9de9
commit 403e14c320
2 changed files with 8 additions and 8 deletions

View File

@ -12,23 +12,23 @@ const (
eventOPKGUpdateResult = "opkg update result" eventOPKGUpdateResult = "opkg update result"
) )
// OPKGUpdateStatus embeds informations about OPKG update status // UpdateStatus embeds informations about update status
type OPKGUpdateStatus struct { type UpdateStatus struct {
Active bool `json:"active"` Active bool `json:"active"`
State string `json:"state"` State string `json:"state"`
Locked bool `json:"locked"` Locked bool `json:"locked"`
} }
// OPKGUpdate asks the ReachRS module to start an OPKG update // Update asks the ReachRS module to start an OPKG update
func (u *Updater) OPKGUpdate() (*OPKGUpdateStatus, error) { func (u *Updater) Update() (*UpdateStatus, error) {
var err error var err error
var status *OPKGUpdateStatus var status *UpdateStatus
var wg sync.WaitGroup var wg sync.WaitGroup
wg.Add(1) wg.Add(1)
err = u.conn.On(eventOPKGUpdateResult, func(h *gosocketio.Channel, st *OPKGUpdateStatus) { err = u.conn.On(eventOPKGUpdateResult, func(h *gosocketio.Channel, st *UpdateStatus) {
status = st status = st
u.conn.Off(eventOPKGUpdateResult) u.conn.Off(eventOPKGUpdateResult)
wg.Done() wg.Done()

View File

@ -7,7 +7,7 @@ import (
func TestClientOPKGUpdate(t *testing.T) { func TestClientOPKGUpdate(t *testing.T) {
if !*runUpdaterIntegrationTests { if !*runUpdaterIntegrationTests {
t.Skip("To run this test, use: go test -integration") t.Skip("To run this test, use: go test -updater-integration")
} }
client := NewUpdaterClient( client := NewUpdaterClient(
@ -18,7 +18,7 @@ func TestClientOPKGUpdate(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
_, err := client.OPKGUpdate() _, err := client.Update()
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }