-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5785 from oasisprotocol/kostko/feature/detached-c…
…omps-autoenable Fix handling of detached bundles
- Loading branch information
Showing
5 changed files
with
81 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
go/runtime/bundle: Use manifest hash at bundle load time |
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,5 @@ | ||
go/runtime: Automatically enable all configured detached components | ||
|
||
Since they are explicitly configured there should be no need to enable | ||
them twice. This just defaults detached components to be enabled and one | ||
needs to explicitly disable them. |
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,56 @@ | ||
package config | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
"gopkg.in/yaml.v3" | ||
|
||
"github.com/oasisprotocol/oasis-core/go/runtime/bundle/component" | ||
) | ||
|
||
func TestComponentConfig(t *testing.T) { | ||
require := require.New(t) | ||
|
||
cfg := Config{ | ||
Components: []ComponentConfig{ | ||
{ | ||
ID: component.ID{Kind: component.ROFL, Name: "foo-test"}, | ||
Disabled: false, | ||
}, | ||
}, | ||
} | ||
|
||
compCfg, ok := cfg.GetComponent(component.ID{Kind: component.ROFL, Name: "foo-test"}) | ||
require.True(ok) | ||
require.EqualValues(compCfg.ID.Kind, component.ROFL) | ||
require.EqualValues(compCfg.ID.Name, "foo-test") | ||
require.False(compCfg.Disabled) | ||
|
||
compCfg, ok = cfg.GetComponent(component.ID{Kind: component.ROFL, Name: "does-not-exist"}) | ||
require.False(ok) | ||
require.EqualValues(compCfg, ComponentConfig{}) | ||
|
||
// Deserialization. | ||
yamlCfg := ` | ||
components: | ||
- rofl.foo-test | ||
- id: rofl.another | ||
disabled: true | ||
` | ||
var decCfg Config | ||
err := yaml.Unmarshal([]byte(yamlCfg), &decCfg) | ||
require.NoError(err, "yaml.Unmarshal") | ||
|
||
compCfg, ok = decCfg.GetComponent(component.ID{Kind: component.ROFL, Name: "foo-test"}) | ||
require.True(ok) | ||
require.EqualValues(compCfg.ID.Kind, component.ROFL) | ||
require.EqualValues(compCfg.ID.Name, "foo-test") | ||
require.False(compCfg.Disabled) | ||
|
||
compCfg, ok = decCfg.GetComponent(component.ID{Kind: component.ROFL, Name: "another"}) | ||
require.True(ok) | ||
require.EqualValues(compCfg.ID.Kind, component.ROFL) | ||
require.EqualValues(compCfg.ID.Name, "another") | ||
require.True(compCfg.Disabled) | ||
} |
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