Skip to content

Commit

Permalink
move
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamgilbert committed Jul 11, 2024
1 parent 2f78cf7 commit 17e9000
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 25 deletions.
9 changes: 1 addition & 8 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@bazel_gazelle//:def.bzl", "gazelle")
# load(":rules.bzl", "foo_binary")

Expand Down Expand Up @@ -103,10 +103,3 @@ go_binary(
goos = "linux",
visibility = ["//visibility:public"],
)

go_test(
name = "osquery-extension_test",
srcs = ["main_test.go"],
embed = [":osquery-extension_lib"],
deps = ["@com_github_stretchr_testify//assert"],
)
6 changes: 1 addition & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func main() {
panic("Version not set")
}

useragent := buildUserAgent(Version)
useragent := sofa.BuildUserAgent(Version)
sofaOpts := []sofa.Option{
sofa.WithUserAgent(useragent),
}
Expand Down Expand Up @@ -113,7 +113,3 @@ func main() {
log.Fatalln(err)
}
}

func buildUserAgent(version string) string {
return "macadmins-osquery-extension/" + version
}
12 changes: 0 additions & 12 deletions main_test.go

This file was deleted.

4 changes: 4 additions & 0 deletions tables/sofa/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,7 @@ func (s *SofaClient) downloadSofaJSON() (Root, error) {

return s.loadCachedData()
}

func BuildUserAgent(version string) string {
return "macadmins-osquery-extension/" + version
}
8 changes: 8 additions & 0 deletions tables/sofa/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,11 @@ func TestCreateCacheDir(t *testing.T) {

assert.DirExists(t, client.cacheDir)
}

func TestBuildUserAgent(t *testing.T) {
version := "1.0.0"
expectedUserAgent := "macadmins-osquery-extension/1.0.0"
userAgent := BuildUserAgent(version)

assert.Equal(t, expectedUserAgent, userAgent)
}

0 comments on commit 17e9000

Please sign in to comment.