MCPcopy Create free account
hub / github.com/dagger/dagger / TestVariable

Method TestVariable

core/integration/container_test.go:876–912  ·  view source on GitHub ↗
(ctx context.Context, t *testctx.T)

Source from the content-addressed store, hash-verified

874}
875
876func (ContainerSuite) TestVariable(ctx context.Context, t *testctx.T) {
877 c := connect(ctx, t)
878 res, err := testutil.QueryWithClient[struct {
879 Container struct {
880 From struct {
881 EnvVariable *string
882 }
883 }
884 }](c, t,
885 `{
886 container {
887 from(address: "golang:1.18.2-alpine") {
888 envVariable(name: "GOLANG_VERSION")
889 }
890 }
891 }`, nil)
892 require.NoError(t, err)
893 require.NotNil(t, res.Container.From.EnvVariable)
894 require.Equal(t, "1.18.2", *res.Container.From.EnvVariable)
895
896 res, err = testutil.QueryWithClient[struct {
897 Container struct {
898 From struct {
899 EnvVariable *string
900 }
901 }
902 }](c, t,
903 `{
904 container {
905 from(address: "golang:1.18.2-alpine") {
906 envVariable(name: "UNKNOWN")
907 }
908 }
909 }`, nil)
910 require.NoError(t, err)
911 require.Nil(t, res.Container.From.EnvVariable)
912}
913
914func (ContainerSuite) TestWithoutVariable(ctx context.Context, t *testctx.T) {
915 res, err := testutil.Query[struct {

Callers

nothing calls this directly

Calls 3

QueryWithClientFunction · 0.92
connectFunction · 0.70
EqualMethod · 0.65

Tested by

no test coverage detected