2021-02-23 10:36:23 +01:00
|
|
|
/*
|
|
|
|
Copyright 2020 Docker Compose CLI authors
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2021-06-14 16:26:14 +02:00
|
|
|
package api
|
2021-02-23 10:36:23 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2023-11-08 10:19:24 +01:00
|
|
|
"github.com/compose-spec/compose-go/v2/types"
|
2021-02-23 10:36:23 +01:00
|
|
|
"gotest.tools/v3/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestRunOptionsEnvironmentMap(t *testing.T) {
|
|
|
|
opts := RunOptions{
|
|
|
|
Environment: []string{
|
|
|
|
"FOO=BAR",
|
|
|
|
"ZOT=",
|
|
|
|
"QIX",
|
|
|
|
},
|
|
|
|
}
|
2021-05-04 02:32:51 +02:00
|
|
|
env := types.NewMappingWithEquals(opts.Environment)
|
2021-02-23 10:36:23 +01:00
|
|
|
assert.Equal(t, *env["FOO"], "BAR")
|
|
|
|
assert.Equal(t, *env["ZOT"], "")
|
|
|
|
assert.Check(t, env["QIX"] == nil)
|
|
|
|
}
|