-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initializing S4 plugin * Addressed PR feedback
- Loading branch information
Andrei Smirnov
committed
Jun 29, 2023
1 parent
367196e
commit 8d3cd36
Showing
5 changed files
with
140 additions
and
22 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 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
41 changes: 41 additions & 0 deletions
41
core/services/ocr2/plugins/functions/config/config_test.go
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,41 @@ | ||
package config_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/functions/config" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
"google.golang.org/protobuf/proto" | ||
) | ||
|
||
func TestS4ConfigDecoder(t *testing.T) { | ||
t.Parallel() | ||
|
||
configProto := &config.ReportingPluginConfig{ | ||
S4PluginConfig: &config.S4ReportingPluginConfig{ | ||
MaxQueryLengthBytes: 100, | ||
MaxObservationLengthBytes: 200, | ||
MaxReportLengthBytes: 300, | ||
NSnapshotShards: 1, | ||
MaxObservationEntries: 111, | ||
MaxReportEntries: 222, | ||
MaxDeleteExpiredEntries: 333, | ||
}, | ||
} | ||
|
||
configBytes, err := proto.Marshal(configProto) | ||
require.NoError(t, err) | ||
|
||
config, limits, err := config.S4ConfigDecoder(configBytes) | ||
require.NoError(t, err) | ||
assert.Equal(t, "functions", config.ProductName) | ||
assert.Equal(t, uint(1), config.NSnapshotShards) | ||
assert.Equal(t, uint(111), config.MaxObservationEntries) | ||
assert.Equal(t, uint(222), config.MaxReportEntries) | ||
assert.Equal(t, uint(333), config.MaxDeleteExpiredEntries) | ||
assert.Equal(t, 100, limits.MaxQueryLength) | ||
assert.Equal(t, 200, limits.MaxObservationLength) | ||
assert.Equal(t, 300, limits.MaxReportLength) | ||
} |
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