Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(config): move syslogconf to config/syslog package #1865

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build

on:
pull_request:

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: build
run: make build
- name: build-scanner
run: make build-scanner
- name: build-trivy-to-vuls
run: make build-trivy-to-vuls
- name: build-future-vuls
run: make build-future-vuls
- name: build-snmp2cpe
run: make build-snmp2cpe
5 changes: 2 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build !windows

package config

import (
Expand All @@ -11,6 +9,7 @@ import (
"github.com/asaskevich/govalidator"
"golang.org/x/xerrors"

"github.com/future-architect/vuls/config/syslog"
"github.com/future-architect/vuls/constant"
"github.com/future-architect/vuls/logging"
)
Expand Down Expand Up @@ -50,7 +49,7 @@ type Config struct {
Slack SlackConf `json:"-"`
EMail SMTPConf `json:"-"`
HTTP HTTPConf `json:"-"`
Syslog SyslogConf `json:"-"`
Syslog syslog.Conf `json:"-"`
AWS AWSConf `json:"-"`
Azure AzureConf `json:"-"`
ChatWork ChatWorkConf `json:"-"`
Expand Down
59 changes: 0 additions & 59 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,65 +6,6 @@ import (
. "github.com/future-architect/vuls/constant"
)

func TestSyslogConfValidate(t *testing.T) {
var tests = []struct {
conf SyslogConf
expectedErrLength int
}{
{
conf: SyslogConf{},
expectedErrLength: 0,
},
{
conf: SyslogConf{
Protocol: "tcp",
Port: "5140",
},
expectedErrLength: 0,
},
{
conf: SyslogConf{
Protocol: "udp",
Port: "12345",
Severity: "emerg",
Facility: "user",
},
expectedErrLength: 0,
},
{
conf: SyslogConf{
Protocol: "foo",
Port: "514",
},
expectedErrLength: 1,
},
{
conf: SyslogConf{
Protocol: "invalid",
Port: "-1",
},
expectedErrLength: 2,
},
{
conf: SyslogConf{
Protocol: "invalid",
Port: "invalid",
Severity: "invalid",
Facility: "invalid",
},
expectedErrLength: 4,
},
}

for i, tt := range tests {
tt.conf.Enabled = true
errs := tt.conf.Validate()
if len(errs) != tt.expectedErrLength {
t.Errorf("test: %d, expected %d, actual %d", i, tt.expectedErrLength, len(errs))
}
}
}

func TestDistro_MajorVersion(t *testing.T) {
var tests = []struct {
in Distro
Expand Down
Loading
Loading