(ctx context.Context, t *testctx.T)
| 1624 | } |
| 1625 | |
| 1626 | func (ContainerSuite) TestWithMountedFile(ctx context.Context, t *testctx.T) { |
| 1627 | c := connect(ctx, t) |
| 1628 | dirRes, err := testutil.QueryWithClient[struct { |
| 1629 | Directory struct { |
| 1630 | WithNewFile struct { |
| 1631 | File struct { |
| 1632 | ID core.FileID |
| 1633 | } |
| 1634 | } |
| 1635 | } |
| 1636 | }](c, t, |
| 1637 | `{ |
| 1638 | directory { |
| 1639 | withNewFile(path: "some-dir/sub-file", contents: "sub-content") { |
| 1640 | file(path: "some-dir/sub-file") { |
| 1641 | id |
| 1642 | } |
| 1643 | } |
| 1644 | } |
| 1645 | }`, nil) |
| 1646 | require.NoError(t, err) |
| 1647 | |
| 1648 | id := dirRes.Directory.WithNewFile.File.ID |
| 1649 | |
| 1650 | execRes, err := testutil.QueryWithClient[struct { |
| 1651 | Container struct { |
| 1652 | From struct { |
| 1653 | WithMountedFile struct { |
| 1654 | WithExec struct { |
| 1655 | Stdout string |
| 1656 | } |
| 1657 | } |
| 1658 | } |
| 1659 | } |
| 1660 | }](c, t, |
| 1661 | `query Test($id: ID!) { |
| 1662 | container { |
| 1663 | from(address: "`+alpineImage+`") { |
| 1664 | withMountedFile(path: "/mnt/file", source: $id) { |
| 1665 | withExec(args: ["cat", "/mnt/file"]) { |
| 1666 | stdout |
| 1667 | } |
| 1668 | } |
| 1669 | } |
| 1670 | } |
| 1671 | }`, &testutil.QueryOptions{Variables: map[string]any{ |
| 1672 | "id": id, |
| 1673 | }}) |
| 1674 | require.NoError(t, err) |
| 1675 | require.Equal(t, "sub-content", execRes.Container.From.WithMountedFile.WithExec.Stdout) |
| 1676 | } |
| 1677 | |
| 1678 | func (ContainerSuite) TestWithMountedCache(ctx context.Context, t *testctx.T) { |
| 1679 | c := connect(ctx, t) |
nothing calls this directly
no test coverage detected