Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
lima-vm
GitHub Repository: lima-vm/lima
Path: blob/master/hack/test-templates/test-misc.yaml
2611 views
1
# The test template for testing misc configurations:
2
# - disk
3
# - snapshots
4
# - (More to come)
5
#
6
base: template:ubuntu-22.04
7
8
# 9p is not compatible with `limactl snapshot`
9
mountTypesUnsupported: ["9p"]
10
mounts:
11
- location: "~"
12
writable: true
13
- location: "/tmp/lima test dir with spaces"
14
writable: true
15
16
param:
17
ANSIBLE: ansible
18
BOOT: boot
19
DEPENDENCY: dependency
20
PROBE: probe
21
SYSTEM: system
22
USER: user
23
YQ: yq
24
25
provision:
26
- mode: ansible
27
playbook: ./hack/ansible-test.yaml
28
- mode: boot
29
script: "touch /tmp/param-$PARAM_BOOT"
30
- mode: dependency
31
script: "touch /tmp/param-$PARAM_DEPENDENCY"
32
- mode: system
33
script: |
34
touch /tmp/param-$PARAM_SYSTEM
35
36
# port forwarding test setup
37
apt-get update
38
apt-get install -y nginx python3
39
systemctl enable nginx
40
systemctl start nginx
41
42
cat > /etc/systemd/system/test-server-9080.service << 'EOF'
43
[Unit]
44
Description=Test Server on Port 9080
45
After=network.target
46
47
[Service]
48
Type=simple
49
User=root
50
ExecStart=/usr/bin/python3 -m http.server 9080 --bind 127.0.0.1
51
Restart=always
52
53
[Install]
54
WantedBy=multi-user.target
55
EOF
56
57
cat > /etc/systemd/system/test-server-9070.service << 'EOF'
58
[Unit]
59
Description=Test Server on Port 9070
60
After=network.target
61
62
[Service]
63
Type=simple
64
User=root
65
ExecStart=/usr/bin/python3 -m http.server 9070 --bind 127.0.0.1
66
Restart=always
67
68
[Install]
69
WantedBy=multi-user.target
70
EOF
71
72
mkdir -p /var/www/html-9080
73
mkdir -p /var/www/html-9070
74
75
echo '<html><body><h1>Dynamic port 9080</h1></body></html>' > /var/www/html-9080/index.html
76
echo '<html><body><h1>Dynamic port 9070</h1></body></html>' > /var/www/html-9070/index.html
77
78
systemctl daemon-reload
79
systemctl enable test-server-9080
80
systemctl enable test-server-9070
81
systemctl start test-server-9080
82
systemctl start test-server-9070
83
84
- mode: user
85
script: "touch /tmp/param-$PARAM_USER"
86
- mode: data
87
path: /etc/sysctl.d/99-inotify.conf
88
content: |
89
fs.inotify.max_user_watches = 524288
90
fs.inotify.max_user_instances = 512
91
- mode: yq
92
path: "/tmp/param-{{.Param.YQ}}.json"
93
expression: .YQ = "{{.Param.YQ}}"
94
95
probes:
96
- mode: readiness
97
script: |
98
#!/bin/sh
99
touch /tmp/param-$PARAM_PROBE
100
101
# in order to use this example, you must first create the disks. run:
102
# $ limactl disk create data --size 10G
103
# $ limactl disk create swap --size 2G
104
additionalDisks:
105
- "data"
106
- name: "swap"
107
format: true
108
fsType: swap
109
110
user:
111
name: john
112
comment: John Doe
113
home: "/home/{{.User}}-{{.User}}"
114
uid: 4711
115
# Ubuntu has identical /bin/bash and /usr/bin/bash
116
shell: /usr/bin/bash
117
118
portForwards:
119
- guestPort: 80
120
hostPort: 9090
121
static: true
122
- guestPort: 9080
123
hostPort: 29080
124
static: false
125
- guestPort: 9070
126
hostPort: 29070
127
static: false
128
129