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"
)
// OPKGUpdateStatus embeds informations about OPKG update status
type OPKGUpdateStatus struct {
// UpdateStatus embeds informations about update status
type UpdateStatus struct {
Active bool `json:"active"`
State string `json:"state"`
Locked bool `json:"locked"`
}
// OPKGUpdate asks the ReachRS module to start an OPKG update
func (u *Updater) OPKGUpdate() (*OPKGUpdateStatus, error) {
// Update asks the ReachRS module to start an OPKG update
func (u *Updater) Update() (*UpdateStatus, error) {
var err error
var status *OPKGUpdateStatus
var status *UpdateStatus
var wg sync.WaitGroup
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
u.conn.Off(eventOPKGUpdateResult)
wg.Done()

View File

@ -7,7 +7,7 @@ import (
func TestClientOPKGUpdate(t *testing.T) {
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(
@ -18,7 +18,7 @@ func TestClientOPKGUpdate(t *testing.T) {
t.Fatal(err)
}
_, err := client.OPKGUpdate()
_, err := client.Update()
if err != nil {
t.Error(err)
}