forked from jenningsloy318/redfish_exporter
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add tests and restructure config
- Loading branch information
Felix Peters
committed
Apr 21, 2024
1 parent
798e0f7
commit d557fa0
Showing
8 changed files
with
93 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: test-and-lint | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
branches: [master] | ||
|
||
jobs: | ||
test-and-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v3 | ||
- uses: actions/setup-go@v5 | ||
|
||
- name: Run pre-commit with linters | ||
uses: pre-commit/[email protected] | ||
|
||
- name: Run tests | ||
run: go test -json > TestResults.json | ||
|
||
- name: Upload Go test results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Upload Go results | ||
path: TestResults.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestConfigFromFile(t *testing.T) { | ||
configFile := "config.example.yml" | ||
|
||
config, err := NewConfigFromFile(configFile) | ||
assert.NoError(t, err) | ||
assert.NotNil(t, config) | ||
|
||
assert.Equal(t, "info", config.Loglevel) | ||
assert.Equal(t, config.Hosts["default"], HostConfig{Username: "user", Password: "pass"}) | ||
assert.Equal(t, config.Groups["group1"], HostConfig{Username: "group1_user", Password: "group1_pass"}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters