Skip to content

Commit

Permalink
Remove redundant log
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Sverdlov <[email protected]>
  • Loading branch information
sverdlov93 committed Sep 22, 2024
1 parent 42f2527 commit 66493f0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions utils/cliutils/persistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func init() {
persistenceFilePath = filepath.Join(homeDir, persistenceFileName)
}

// SetCliLatestVersionCheckTime updates the latest version check time in the persistence file
func SetCliLatestVersionCheckTime(timestamp int64) error {
// setCliLatestVersionCheckTime updates the latest version check time in the persistence file
func setCliLatestVersionCheckTime(timestamp int64) error {
fileLock.Lock()
defer fileLock.Unlock()

Expand All @@ -47,8 +47,8 @@ func SetCliLatestVersionCheckTime(timestamp int64) error {
return setPersistenceInfo(info)
}

// GetLatestCliVersionCheckTime retrieves the latest version check time from the persistence file
func GetLatestCliVersionCheckTime() (*int64, error) {
// getLatestCliVersionCheckTime retrieves the latest version check time from the persistence file
func getLatestCliVersionCheckTime() (*int64, error) {
fileLock.Lock()
defer fileLock.Unlock()

Expand Down
6 changes: 3 additions & 3 deletions utils/cliutils/persistence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ func TestSetAndGetLatestVersionCheckTime(t *testing.T) {

// Set the timestamp
timestamp := time.Now().UnixMilli()
err := SetCliLatestVersionCheckTime(timestamp)
err := setCliLatestVersionCheckTime(timestamp)
assert.NoError(t, err, "Failed to set LatestCliVersionCheckTime")

// Get the timestamp
storedTimestamp, err := GetLatestCliVersionCheckTime()
storedTimestamp, err := getLatestCliVersionCheckTime()
assert.NoError(t, err, "Failed to get LatestCliVersionCheckTime")

// Assert equality
Expand Down Expand Up @@ -56,7 +56,7 @@ func TestPersistenceFileCreation(t *testing.T) {

// Trigger file creation by setting version check time
timestamp := time.Now().UnixMilli()
err = SetCliLatestVersionCheckTime(timestamp)
err = setCliLatestVersionCheckTime(timestamp)
assert.NoError(t, err, "Failed to set LatestCliVersionCheckTime")

// Verify the persistence file was created
Expand Down
4 changes: 2 additions & 2 deletions utils/cliutils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ func shouldCheckLatestCliVersion() (shouldCheck bool, err error) {
if strings.ToLower(os.Getenv(JfrogCliAvoidNewVersionWarning)) == "true" {
return
}
latestVersionCheckTime, err := GetLatestCliVersionCheckTime()
latestVersionCheckTime, err := getLatestCliVersionCheckTime()
if err != nil {
return
}
Expand All @@ -711,7 +711,7 @@ func shouldCheckLatestCliVersion() (shouldCheck bool, err error) {
// Timestamp file exists and updated less than 6 hours ago, therefor no need to check version again
return
}
if err = SetCliLatestVersionCheckTime(timeNow); err != nil {
if err = setCliLatestVersionCheckTime(timeNow); err != nil {
return
}
return true, nil
Expand Down
2 changes: 1 addition & 1 deletion utils/cliutils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func TestShouldCheckLatestCliVersion(t *testing.T) {
assert.NoError(t, err)
assert.False(t, shouldCheck)

assert.NoError(t, SetCliLatestVersionCheckTime(time.Now().UnixMilli()-LatestCliVersionCheckInterval.Milliseconds()))
assert.NoError(t, setCliLatestVersionCheckTime(time.Now().UnixMilli()-LatestCliVersionCheckInterval.Milliseconds()))
// Third run, more than 6 hours between runs, so should return true
shouldCheck, err = shouldCheckLatestCliVersion()
assert.NoError(t, err)
Expand Down

0 comments on commit 66493f0

Please sign in to comment.