blob: 00fc1e4f0dbef842cf26cd811317e7217c1abd56 [file] [log] [blame]
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Unit tests for the TestUpdateEngineStatus implementation.
package updateengine
import (
"reflect"
"testing"
)
const tmpUpdateEngineCmd = "testdata/update_engine.sh"
func TestUpdateEngineStatus(t *testing.T) {
want := []byte("CURRENT_OP=UPDATE_STATUS_UPDATED_NEED_REBOOT\nLAST_CHECKED_TIME=1646430409\nNEW_VERSION=0.0.0.0")
got, err := UpdateEngineStatus(tmpUpdateEngineCmd)
if err != nil {
t.Errorf("got unexpected error: %v", err)
}
if reflect.DeepEqual(got, want) {
t.Errorf("got: %s, want: %s", got, want)
}
}