-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Compose transpilation checkpoint
mieubrisse
committed
Oct 27, 2023
1 parent
7094c56
commit 23156f4
Showing
3 changed files
with
57 additions
and
25 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
31 changes: 31 additions & 0 deletions
31
core/server/api_container/server/docker_compose_tranpsiler/docker_compose_transpiler_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,31 @@ | ||
package docker_compose_tranpsiler | ||
|
||
import ( | ||
"github.com/stretchr/testify/require" | ||
"testing" | ||
) | ||
|
||
func TestMinecraftCompose(t *testing.T) { | ||
composeBytes := []byte(` | ||
services: | ||
minecraft: | ||
image: itzg/minecraft-server | ||
ports: | ||
- "25565:25565" | ||
environment: | ||
EULA: "TRUE" | ||
deploy: | ||
resources: | ||
limits: | ||
memory: 1.5G | ||
volumes: | ||
- "~/minecraft_data:/data" | ||
`) | ||
expectedResult := `def run(plan): | ||
plan.add_service(name="minecraft",config=ServiceConfig(image="itzg/minecraft-server",ports={"port0":PortSpec(number=25565)},env_vars={"EULA":"TRUE"})) | ||
` | ||
|
||
result, err := convertComposeToStarlark(composeBytes, map[string]string{}) | ||
require.NoError(t, err) | ||
require.Equal(t, expectedResult, result) | ||
} |
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