Skip to content

Commit

Permalink
Merge pull request #311 from lacework/afiune/ALLY-305/disable-telemet…
Browse files Browse the repository at this point in the history
…ry-and-updater-install.sh
  • Loading branch information
afiune authored Jan 31, 2021
2 parents a5c5eeb + 15c371c commit 9793261
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
4 changes: 4 additions & 0 deletions cli/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ func versionCacheDir() (string, error) {
// dailyVersionCheck will execute a version check on a daily basis, the function uses
// the file ~/.config/lacework/version_cache to track the last check time
func dailyVersionCheck() error {
if disabled := os.Getenv(lwupdater.DisableEnv); disabled != "" {
return nil
}

cacheDir, err := versionCacheDir()
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cli/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ install_cli() {

print_cli_version() {
log "Verifying installed Lacework CLI version"
"${installation_dir}/${binary_name}" version
LW_TELEMETRY_DISABLE=1 LW_UPDATES_DISABLE=1 "${installation_dir}/${binary_name}" version
}

download_file() {
Expand Down
29 changes: 17 additions & 12 deletions integration/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package integration

import (
"strings"
"testing"
"time"

Expand Down Expand Up @@ -58,26 +59,30 @@ func TestEventCommandList(t *testing.T) {
"EXITCODE is not the expected one")
}

func TestEventCommandList3Days(t *testing.T) {
func TestEventCommandList4Days(t *testing.T) {
// @afiune could we find a way to generate a consistent event? but if we do
// wouldn't the ML learn it and then become a known behavior? uhmmm
// for now we will just check that we have the headers :wink:
out, err, exitcode := LaceworkCLIWithTOMLConfig("event", "list", "--days", "3")
assert.Contains(t, out.String(), "EVENT ID",
"STDOUT table headers changed, please check")
assert.Contains(t, out.String(), "TYPE",
"STDOUT table headers changed, please check")
assert.Contains(t, out.String(), "SEVERITY",
"STDOUT table headers changed, please check")
assert.Contains(t, out.String(), "START TIME",
"STDOUT table headers changed, please check")
assert.Contains(t, out.String(), "END TIME",
"STDOUT table headers changed, please check")
out, err, exitcode := LaceworkCLIWithTOMLConfig("event", "list", "--days", "4")
assert.Empty(t,
err.String(),
"STDERR should be empty")
assert.Equal(t, 0, exitcode,
"EXITCODE is not the expected one")

// only verify the table headers if there are events
if !strings.Contains(out.String(), "There are no events in your account in the specified time range.") {
assert.Contains(t, out.String(), "EVENT ID",
"STDOUT table headers changed, please check")
assert.Contains(t, out.String(), "TYPE",
"STDOUT table headers changed, please check")
assert.Contains(t, out.String(), "SEVERITY",
"STDOUT table headers changed, please check")
assert.Contains(t, out.String(), "START TIME",
"STDOUT table headers changed, please check")
assert.Contains(t, out.String(), "END TIME",
"STDOUT table headers changed, please check")
}
}

func TestEventCommandListSeverityError(t *testing.T) {
Expand Down

0 comments on commit 9793261

Please sign in to comment.