Skip to content

Commit 6566598

Browse files
committed
fix provider version error
1 parent 5d0fe0b commit 6566598

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

oci/errors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ func getVersionAndDateError() string {
173173
releaseDate, _ := time.Parse("2006-01-02", ReleaseDate)
174174
days := today.Sub(releaseDate).Hours() / 24
175175

176-
if days > 7 {
176+
if days > 8 {
177177
versionOld := int(days / 7)
178-
result += fmt.Sprintf("This provider is %v updates behind to current.", versionOld)
178+
result += fmt.Sprintf("This provider is %v update(s) behind to current.", versionOld)
179179
}
180180
return result
181181
}

oci/errors_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
package oci
5+
6+
import (
7+
"testing"
8+
9+
"github.com/stretchr/testify/assert"
10+
)
11+
12+
func TestUnitGetVersionAndDateError(t *testing.T) {
13+
versionError := getVersionAndDateError()
14+
assert.Contains(t, versionError, "Provider version: ")
15+
assert.Contains(t, versionError, Version)
16+
assert.Contains(t, versionError, ReleaseDate)
17+
assert.NotContains(t, versionError, "update(s) behind to current")
18+
}

0 commit comments

Comments
 (0)