23 lines
646 B
Go
23 lines
646 B
Go
|
|
package config
|
||
|
|
|
||
|
|
import (
|
||
|
|
"testing"
|
||
|
|
|
||
|
|
"gitea.maximumdirect.net/eric/notarius/internal/framework/pipeline"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestValidateUsesMapIdentityWithoutMutatingProfile(t *testing.T) {
|
||
|
|
cfg := Default()
|
||
|
|
cfg.Pipelines[" demo "] = pipeline.PipelineProfile{Artifacts: map[string]pipeline.ArtifactLaneProfile{" lane ": {}}}
|
||
|
|
if err := cfg.Validate(); err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
profile := cfg.Pipelines[" demo "]
|
||
|
|
if profile.ID != "" || len(profile.Artifacts) != 1 {
|
||
|
|
t.Fatalf("validation mutated profile: %#v", profile)
|
||
|
|
}
|
||
|
|
if _, ok := profile.Artifacts[" lane "]; !ok {
|
||
|
|
t.Fatalf("validation changed lane identity: %#v", profile.Artifacts)
|
||
|
|
}
|
||
|
|
}
|