-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Improve general coverage of the codebase: - covered a few configs by tests - file content expansion in configurations
- Loading branch information
1 parent
a04eccf
commit 3742035
Showing
9 changed files
with
104 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package http | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestHTTPConfig_DefaultConfig(t *testing.T) { | ||
config := DefaultServerConfig() | ||
|
||
require.NotNil(t, config.Address()) | ||
require.NotNil(t, config.ToServer()) | ||
} |
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,6 @@ | ||
name: "OpenAI" | ||
api_key: "${file:./testdata/doesntexist}" | ||
|
||
params: | ||
- name: budget | ||
value: "$$${file:./testdata/doesntexist}" |
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,6 @@ | ||
name: "OpenAI" | ||
api_key: "${file:./testdata/openai_key}" | ||
|
||
params: | ||
- name: budget | ||
value: "$$${file:./testdata/openai_key}" |
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 @@ | ||
sk-fakeapi-token |
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,13 @@ | ||
package retry | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestRetryConfig_DefaultConfig(t *testing.T) { | ||
config := DefaultExpRetryConfig() | ||
|
||
require.NotNil(t, config) | ||
} |
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,27 @@ | ||
package telemetry | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestLogging_PlainOutputSetup(t *testing.T) { | ||
config := LogConfig{ | ||
Encoding: "console", | ||
} | ||
zapConfig := config.ToZapConfig() | ||
|
||
require.Equal(t, "console", config.Encoding) | ||
require.NotNil(t, zapConfig) | ||
require.Equal(t, "console", zapConfig.Encoding) | ||
} | ||
|
||
func TestLogging_JSONOutputSetup(t *testing.T) { | ||
config := DefaultLogConfig() | ||
zapConfig := config.ToZapConfig() | ||
|
||
require.Equal(t, "json", config.Encoding) | ||
require.NotNil(t, zapConfig) | ||
require.Equal(t, "json", zapConfig.Encoding) | ||
} |
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,12 @@ | ||
package telemetry | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestTelemetry_Creation(t *testing.T) { | ||
_, err := NewTelemetry(DefaultConfig()) | ||
require.NoError(t, err) | ||
} |