| 1 |
# Copyright (c) Alexei Znamensky ([email protected]) |
| 2 |
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 3 |
# SPDX-License-Identifier: GPL-3.0-or-later |
| 4 |
|
| 5 |
from __future__ import annotations |
| 6 |
|
| 7 |
import sys |
| 8 |
|
| 9 |
from ansible_collections.community.general.plugins.modules import snap |
| 10 |
|
| 11 |
from .uthelper import RunCommandMock, UTHelper |
| 12 |
|
| 13 |
issue_6803_status_out = """Name Version Rev Tracking Publisher Notes |
| 14 |
core20 20220826 1623 latest/stable canonical** base |
| 15 |
lxd 5.6-794016a 23680 latest/stable/… canonical** - |
| 16 |
snapd 2.57.4 17336 latest/stable canonical** snapd |
| 17 |
""" |
| 18 |
|
| 19 |
issue_6803_microk8s_out = ( |
| 20 |
'\rEnsure prerequisites for "microk8s" are available /' |
| 21 |
'\rDownload snap "microk8s" (5372) from channel "1.27/stable" ' |
| 22 |
'\rDownload snap "microk8s" (5372) from channel "1.27/stable" \\' |
| 23 |
'\rDownload snap "microk8s" (5372) from channel "1.27/stable" ' |
| 24 |
'\rDownload snap "microk8s" (5372) from channel "1.27/stable" /\u001b[?25' |
| 25 |
'\r\u001b[7m\u001b[0mDownload snap "microk8s" (5372) from channel "1.27/stable" 0% 0B/s ages' |
| 26 |
'\r\u001b[7m\u001b[0mDownload snap "microk8s" (5372) from channel "1.27/stable" 0% 0B/s ages' |
| 27 |
'\r\u001b[7m\u001b[0mDownload snap "microk8s" (5372) from channel "1.27/stable" 0% 0B/s ages' |
| 28 |
'\r\u001b[7m\u001b[0mDownload snap "microk8s" (5372) from channel "1.27/stable" 0% 880kB/s 3m21' |
| 29 |
'\r\u001b[7m\u001b[0mDownload snap "microk8s" (5372) from channel "1.27/stable" 1% 2.82MB/s 1m02' |
| 30 |
'\r\u001b[7mD\u001b[0mownload snap "microk8s" (5372) from channel "1.27/stable" 2% 4.71MB/s 37.0' |
| 31 |
'\r\u001b[7mDo\u001b[0mwnload snap "microk8s" (5372) from channel "1.27/stable" 4% 9.09MB/s 18.8' |
| 32 |
'\r\u001b[7mDown\u001b[0mload snap "microk8s" (5372) from channel "1.27/stable" 6% 12.4MB/s 13.5' |
| 33 |
'\r\u001b[7mDownl\u001b[0moad snap "microk8s" (5372) from channel "1.27/stable" 7% 14.5MB/s 11.3' |
| 34 |
'\r\u001b[7mDownloa\u001b[0md snap "microk8s" (5372) from channel "1.27/stable" 9% 15.9MB/s 10.1' |
| 35 |
'\r\u001b[7mDownload \u001b[0msnap "microk8s" (5372) from channel "1.27/stable" 11% 18.0MB/s 8.75' |
| 36 |
'\r\u001b[7mDownload s\u001b[0mnap "microk8s" (5372) from channel "1.27/stable" 13% 19.4MB/s 7.91' |
| 37 |
'\r\u001b[7mDownload sn\u001b[0map "microk8s" (5372) from channel "1.27/stable" 15% 20.1MB/s 7.50' |
| 38 |
'\r\u001b[7mDownload snap\u001b[0m "microk8s" (5372) from channel "1.27/stable" 17% 20.9MB/s 7.05' |
| 39 |
'\r\u001b[7mDownload snap "\u001b[0mmicrok8s" (5372) from channel "1.27/stable" 19% 22.1MB/s 6.50' |
| 40 |
'\r\u001b[7mDownload snap "m\u001b[0microk8s" (5372) from channel "1.27/stable" 21% 22.9MB/s 6.11' |
| 41 |
'\r\u001b[7mDownload snap "mic\u001b[0mrok8s" (5372) from channel "1.27/stable" 23% 23.2MB/s 5.90' |
| 42 |
'\r\u001b[7mDownload snap "micr\u001b[0mok8s" (5372) from channel "1.27/stable" 25% 23.9MB/s 5.58' |
| 43 |
'\r\u001b[7mDownload snap "microk\u001b[0m8s" (5372) from channel "1.27/stable" 27% 24.5MB/s 5.30' |
| 44 |
'\r\u001b[7mDownload snap "microk8\u001b[0ms" (5372) from channel "1.27/stable" 29% 24.9MB/s 5.09' |
| 45 |
'\r\u001b[7mDownload snap "microk8s"\u001b[0m (5372) from channel "1.27/stable" 31% 25.4MB/s 4.85' |
| 46 |
'\r\u001b[7mDownload snap "microk8s" (\u001b[0m5372) from channel "1.27/stable" 33% 25.8MB/s 4.63' |
| 47 |
'\r\u001b[7mDownload snap "microk8s" (5\u001b[0m372) from channel "1.27/stable" 35% 26.2MB/s 4.42' |
| 48 |
'\r\u001b[7mDownload snap "microk8s" (53\u001b[0m72) from channel "1.27/stable" 36% 26.3MB/s 4.30' |
| 49 |
'\r\u001b[7mDownload snap "microk8s" (5372\u001b[0m) from channel "1.27/stable" 38% 26.7MB/s 4.10' |
| 50 |
'\r\u001b[7mDownload snap "microk8s" (5372) \u001b[0mfrom channel "1.27/stable" 40% 26.9MB/s 3.95' |
| 51 |
'\r\u001b[7mDownload snap "microk8s" (5372) f\u001b[0mrom channel "1.27/stable" 42% 27.2MB/s 3.77' |
| 52 |
'\r\u001b[7mDownload snap "microk8s" (5372) fro\u001b[0mm channel "1.27/stable" 44% 27.4MB/s 3.63' |
| 53 |
'\r\u001b[7mDownload snap "microk8s" (5372) from\u001b[0m channel "1.27/stable" 46% 27.8MB/s 3.44' |
| 54 |
'\r\u001b[7mDownload snap "microk8s" (5372) from c\u001b[0mhannel "1.27/stable" 48% 27.9MB/s 3.31' |
| 55 |
'\r\u001b[7mDownload snap "microk8s" (5372) from cha\u001b[0mnnel "1.27/stable" 50% 28.1MB/s 3.15' |
| 56 |
'\r\u001b[7mDownload snap "microk8s" (5372) from chan\u001b[0mnel "1.27/stable" 52% 28.3MB/s 3.02' |
| 57 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channe\u001b[0ml "1.27/stable" 54% 28.5MB/s 2.87' |
| 58 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel\u001b[0m "1.27/stable" 56% 28.6MB/s 2.75' |
| 59 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel \u001b[0m"1.27/stable" 57% 28.7MB/s 2.63' |
| 60 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1\u001b[0m.27/stable" 60% 28.9MB/s 2.47' |
| 61 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.2\u001b[0m7/stable" 62% 29.0MB/s 2.35' |
| 62 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27\u001b[0m/stable" 63% 29.1MB/s 2.23' |
| 63 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/s\u001b[0mtable" 65% 29.2MB/s 2.10' |
| 64 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/st\u001b[0mable" 67% 29.4MB/s 1.97' |
| 65 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stab\u001b[0mle" 69% 29.5MB/s 1.85' |
| 66 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stabl\u001b[0me" 71% 29.5MB/s 1.74' |
| 67 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stable"\u001b[0m 73% 29.7MB/s 1.59' |
| 68 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stable" \u001b[0m 75% 29.8MB/s 1.48' |
| 69 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stable" \u001b[0m 77% 29.8MB/s 1.37' |
| 70 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stable" 7\u001b[0m9% 29.9MB/s 1.26' |
| 71 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stable" 81\u001b[0m% 30.0MB/s 1.14' |
| 72 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stable" 83% \u001b[0m30.1MB/s 1.01' |
| 73 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stable" 84% 3\u001b[0m0.1MB/s 919m' |
| 74 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stable" 86% 30.\u001b[0m1MB/s 810m' |
| 75 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stable" 88% 30.2\u001b[0mMB/s 676m' |
| 76 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stable" 91% 30.3MB\u001b[0m/s 555m' |
| 77 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stable" 93% 30.4MB/s\u001b[0m 436m' |
| 78 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stable" 95% 30.5MB/s \u001b[0m317m' |
| 79 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stable" 96% 30.5MB/s 21\u001b[0m1m' |
| 80 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stable" 98% 30.5MB/s 117\u001b[0mm' |
| 81 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stable" 100% 30.5MB/s 11m\u001b[0m' |
| 82 |
'\r\u001b[7mDownload snap "microk8s" (5372) from channel "1.27/stable" 100% 30.0MB/s 0.0ns\u001b[0' |
| 83 |
'\rFetch and check assertions for snap "microk8s" (5372) ' |
| 84 |
'\rMount snap "microk8s" (5372) \\' |
| 85 |
'\rMount snap "microk8s" (5372) ' |
| 86 |
'\rMount snap "microk8s" (5372) ' |
| 87 |
'\rMount snap "microk8s" (5372) ' |
| 88 |
'\rSetup snap "microk8s" (5372) security profiles \\' |
| 89 |
'\rSetup snap "microk8s" (5372) security profiles ' |
| 90 |
'\rSetup snap "microk8s" (5372) security profiles ' |
| 91 |
'\rSetup snap "microk8s" (5372) security profiles ' |
| 92 |
'\rSetup snap "microk8s" (5372) security profiles \\' |
| 93 |
'\rSetup snap "microk8s" (5372) security profiles ' |
| 94 |
'\rSetup snap "microk8s" (5372) security profiles ' |
| 95 |
'\rSetup snap "microk8s" (5372) security profiles ' |
| 96 |
'\rSetup snap "microk8s" (5372) security profiles \\' |
| 97 |
'\rSetup snap "microk8s" (5372) security profiles ' |
| 98 |
'\rSetup snap "microk8s" (5372) security profiles ' |
| 99 |
'\rRun install hook of "microk8s" snap if present ' |
| 100 |
'\rRun install hook of "microk8s" snap if present \\' |
| 101 |
'\rRun install hook of "microk8s" snap if present ' |
| 102 |
'\rRun install hook of "microk8s" snap if present ' |
| 103 |
'\rRun install hook of "microk8s" snap if present ' |
| 104 |
'\rRun install hook of "microk8s" snap if present \\' |
| 105 |
'\rRun install hook of "microk8s" snap if present ' |
| 106 |
'\rRun install hook of "microk8s" snap if present ' |
| 107 |
'\rRun install hook of "microk8s" snap if present ' |
| 108 |
'\rRun install hook of "microk8s" snap if present \\' |
| 109 |
'\rRun install hook of "microk8s" snap if present ' |
| 110 |
'\rRun install hook of "microk8s" snap if present ' |
| 111 |
'\rRun install hook of "microk8s" snap if present ' |
| 112 |
'\rRun install hook of "microk8s" snap if present \\' |
| 113 |
'\rRun install hook of "microk8s" snap if present ' |
| 114 |
'\rRun install hook of "microk8s" snap if present ' |
| 115 |
'\rRun install hook of "microk8s" snap if present ' |
| 116 |
'\rRun install hook of "microk8s" snap if present \\' |
| 117 |
'\rRun install hook of "microk8s" snap if present ' |
| 118 |
'\rRun install hook of "microk8s" snap if present ' |
| 119 |
'\rRun install hook of "microk8s" snap if present ' |
| 120 |
'\rRun install hook of "microk8s" snap if present \\' |
| 121 |
'\rRun install hook of "microk8s" snap if present ' |
| 122 |
'\rRun install hook of "microk8s" snap if present ' |
| 123 |
'\rRun install hook of "microk8s" snap if present ' |
| 124 |
'\rRun install hook of "microk8s" snap if present \\' |
| 125 |
'\rRun install hook of "microk8s" snap if present ' |
| 126 |
'\rRun install hook of "microk8s" snap if present ' |
| 127 |
'\rRun install hook of "microk8s" snap if present ' |
| 128 |
'\rRun install hook of "microk8s" snap if present \\' |
| 129 |
'\rRun install hook of "microk8s" snap if present ' |
| 130 |
'\rRun install hook of "microk8s" snap if present ' |
| 131 |
'\rRun install hook of "microk8s" snap if present ' |
| 132 |
'\rRun install hook of "microk8s" snap if present \\' |
| 133 |
'\rRun install hook of "microk8s" snap if present ' |
| 134 |
'\rRun install hook of "microk8s" snap if present ' |
| 135 |
'\rRun install hook of "microk8s" snap if present ' |
| 136 |
'\rRun install hook of "microk8s" snap if present \\' |
| 137 |
'\rRun install hook of "microk8s" snap if present ' |
| 138 |
'\rRun install hook of "microk8s" snap if present ' |
| 139 |
'\rRun install hook of "microk8s" snap if present ' |
| 140 |
'\rRun install hook of "microk8s" snap if present \\' |
| 141 |
'\rRun install hook of "microk8s" snap if present ' |
| 142 |
'\rRun install hook of "microk8s" snap if present ' |
| 143 |
'\rRun install hook of "microk8s" snap if present ' |
| 144 |
'\rRun install hook of "microk8s" snap if present \\' |
| 145 |
'\rRun install hook of "microk8s" snap if present ' |
| 146 |
'\rRun install hook of "microk8s" snap if present ' |
| 147 |
'\rRun install hook of "microk8s" snap if present ' |
| 148 |
'\rRun install hook of "microk8s" snap if present \\' |
| 149 |
'\rRun install hook of "microk8s" snap if present ' |
| 150 |
'\rRun install hook of "microk8s" snap if present ' |
| 151 |
'\rRun install hook of "microk8s" snap if present ' |
| 152 |
'\rRun install hook of "microk8s" snap if present \\' |
| 153 |
'\rRun install hook of "microk8s" snap if present ' |
| 154 |
'\rRun install hook of "microk8s" snap if present ' |
| 155 |
'\rRun install hook of "microk8s" snap if present ' |
| 156 |
'\rStart snap "microk8s" (5372) services \\' |
| 157 |
'\rStart snap "microk8s" (5372) services ' |
| 158 |
'\rStart snap "microk8s" (5372) services ' |
| 159 |
'\rStart snap "microk8s" (5372) services ' |
| 160 |
'\rStart snap "microk8s" (5372) services \\' |
| 161 |
'\rStart snap "microk8s" (5372) services ' |
| 162 |
'\rStart snap "microk8s" (5372) services ' |
| 163 |
'\rStart snap "microk8s" (5372) services ' |
| 164 |
'\rStart snap "microk8s" (5372) services \\' |
| 165 |
'\rStart snap "microk8s" (5372) services ' |
| 166 |
'\rStart snap "microk8s" (5372) services ' |
| 167 |
'\rStart snap "microk8s" (5372) services ' |
| 168 |
'\rStart snap "microk8s" (5372) services \\' |
| 169 |
'\rStart snap "microk8s" (5372) services ' |
| 170 |
'\rStart snap "microk8s" (5372) services ' |
| 171 |
'\rStart snap "microk8s" (5372) services ' |
| 172 |
'\rStart snap "microk8s" (5372) services \\' |
| 173 |
'\rRun configure hook of "microk8s" snap if present ' |
| 174 |
'\rRun configure hook of "microk8s" snap if present ' |
| 175 |
'\rRun configure hook of "microk8s" snap if present ' |
| 176 |
'\rRun configure hook of "microk8s" snap if present \\' |
| 177 |
'\rRun configure hook of "microk8s" snap if present ' |
| 178 |
'\rRun configure hook of "microk8s" snap if present ' |
| 179 |
'\rRun configure hook of "microk8s" snap if present ' |
| 180 |
'\rRun configure hook of "microk8s" snap if present \\' |
| 181 |
'\rRun configure hook of "microk8s" snap if present ' |
| 182 |
'\rRun configure hook of "microk8s" snap if present ' |
| 183 |
'\rRun configure hook of "microk8s" snap if present ' |
| 184 |
'\rRun configure hook of "microk8s" snap if present \\' |
| 185 |
'\rRun configure hook of "microk8s" snap if present ' |
| 186 |
'\rRun configure hook of "microk8s" snap if present ' |
| 187 |
'\rRun configure hook of "microk8s" snap if present ' |
| 188 |
'\rRun configure hook of "microk8s" snap if present \\' |
| 189 |
'\rRun configure hook of "microk8s" snap if present ' |
| 190 |
'\rRun configure hook of "microk8s" snap if present ' |
| 191 |
'\rRun configure hook of "microk8s" snap if present ' |
| 192 |
'\rRun configure hook of "microk8s" snap if present \\' |
| 193 |
'\rRun configure hook of "microk8s" snap if present ' |
| 194 |
'\rRun service command "restart" for services ["daemon-apiserver-proxy"] of snap "' |
| 195 |
"\r\u001b[0m\u001b[?25h\u001b[Kmicrok8s (1.27/stable) v1.27.2 from Canonical** installed\n" |
| 196 |
) |
| 197 |
|
| 198 |
issue_6803_kubectl_out = ( |
| 199 |
'\rEnsure prerequisites for "kubectl" are available /' |
| 200 |
'\rDownload snap "kubectl" (5372) from channel "1.27/stable" ' |
| 201 |
'\rDownload snap "kubectl" (5372) from channel "1.27/stable" \\' |
| 202 |
'\rDownload snap "kubectl" (5372) from channel "1.27/stable" ' |
| 203 |
'\rDownload snap "kubectl" (5372) from channel "1.27/stable" /\u001b[?25' |
| 204 |
'\r\u001b[7m\u001b[0mDownload snap "kubectl" (5372) from channel "1.27/stable" 0% 0B/s ages' |
| 205 |
'\r\u001b[7m\u001b[0mDownload snap "kubectl" (5372) from channel "1.27/stable" 0% 0B/s ages' |
| 206 |
'\r\u001b[7m\u001b[0mDownload snap "kubectl" (5372) from channel "1.27/stable" 0% 0B/s ages' |
| 207 |
'\r\u001b[7m\u001b[0mDownload snap "kubectl" (5372) from channel "1.27/stable" 0% 880kB/s 3m21' |
| 208 |
'\r\u001b[7m\u001b[0mDownload snap "kubectl" (5372) from channel "1.27/stable" 1% 2.82MB/s 1m02' |
| 209 |
'\r\u001b[7mD\u001b[0mownload snap "kubectl" (5372) from channel "1.27/stable" 2% 4.71MB/s 37.0' |
| 210 |
'\r\u001b[7mDo\u001b[0mwnload snap "kubectl" (5372) from channel "1.27/stable" 4% 9.09MB/s 18.8' |
| 211 |
'\r\u001b[7mDown\u001b[0mload snap "kubectl" (5372) from channel "1.27/stable" 6% 12.4MB/s 13.5' |
| 212 |
'\r\u001b[7mDownl\u001b[0moad snap "kubectl" (5372) from channel "1.27/stable" 7% 14.5MB/s 11.3' |
| 213 |
'\r\u001b[7mDownloa\u001b[0md snap "kubectl" (5372) from channel "1.27/stable" 9% 15.9MB/s 10.1' |
| 214 |
'\r\u001b[7mDownload \u001b[0msnap "kubectl" (5372) from channel "1.27/stable" 11% 18.0MB/s 8.75' |
| 215 |
'\r\u001b[7mDownload s\u001b[0mnap "kubectl" (5372) from channel "1.27/stable" 13% 19.4MB/s 7.91' |
| 216 |
'\r\u001b[7mDownload sn\u001b[0map "kubectl" (5372) from channel "1.27/stable" 15% 20.1MB/s 7.50' |
| 217 |
'\r\u001b[7mDownload snap\u001b[0m "kubectl" (5372) from channel "1.27/stable" 17% 20.9MB/s 7.05' |
| 218 |
'\r\u001b[7mDownload snap "\u001b[0mkubectl" (5372) from channel "1.27/stable" 19% 22.1MB/s 6.50' |
| 219 |
'\r\u001b[7mDownload snap "m\u001b[0kubectl" (5372) from channel "1.27/stable" 21% 22.9MB/s 6.11' |
| 220 |
'\r\u001b[7mDownload snap "mic\u001b[0mrok8s" (5372) from channel "1.27/stable" 23% 23.2MB/s 5.90' |
| 221 |
'\r\u001b[7mDownload snap "micr\u001b[0mok8s" (5372) from channel "1.27/stable" 25% 23.9MB/s 5.58' |
| 222 |
'\r\u001b[7mDownload snap "microk\u001b[0m8s" (5372) from channel "1.27/stable" 27% 24.5MB/s 5.30' |
| 223 |
'\r\u001b[7mDownload snap "microk8\u001b[0ms" (5372) from channel "1.27/stable" 29% 24.9MB/s 5.09' |
| 224 |
'\r\u001b[7mDownload snap "kubectl"\u001b[0m (5372) from channel "1.27/stable" 31% 25.4MB/s 4.85' |
| 225 |
'\r\u001b[7mDownload snap "kubectl" (\u001b[0m5372) from channel "1.27/stable" 33% 25.8MB/s 4.63' |
| 226 |
'\r\u001b[7mDownload snap "kubectl" (5\u001b[0m372) from channel "1.27/stable" 35% 26.2MB/s 4.42' |
| 227 |
'\r\u001b[7mDownload snap "kubectl" (53\u001b[0m72) from channel "1.27/stable" 36% 26.3MB/s 4.30' |
| 228 |
'\r\u001b[7mDownload snap "kubectl" (5372\u001b[0m) from channel "1.27/stable" 38% 26.7MB/s 4.10' |
| 229 |
'\r\u001b[7mDownload snap "kubectl" (5372) \u001b[0mfrom channel "1.27/stable" 40% 26.9MB/s 3.95' |
| 230 |
'\r\u001b[7mDownload snap "kubectl" (5372) f\u001b[0mrom channel "1.27/stable" 42% 27.2MB/s 3.77' |
| 231 |
'\r\u001b[7mDownload snap "kubectl" (5372) fro\u001b[0mm channel "1.27/stable" 44% 27.4MB/s 3.63' |
| 232 |
'\r\u001b[7mDownload snap "kubectl" (5372) from\u001b[0m channel "1.27/stable" 46% 27.8MB/s 3.44' |
| 233 |
'\r\u001b[7mDownload snap "kubectl" (5372) from c\u001b[0mhannel "1.27/stable" 48% 27.9MB/s 3.31' |
| 234 |
'\r\u001b[7mDownload snap "kubectl" (5372) from cha\u001b[0mnnel "1.27/stable" 50% 28.1MB/s 3.15' |
| 235 |
'\r\u001b[7mDownload snap "kubectl" (5372) from chan\u001b[0mnel "1.27/stable" 52% 28.3MB/s 3.02' |
| 236 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channe\u001b[0ml "1.27/stable" 54% 28.5MB/s 2.87' |
| 237 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel\u001b[0m "1.27/stable" 56% 28.6MB/s 2.75' |
| 238 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel \u001b[0m"1.27/stable" 57% 28.7MB/s 2.63' |
| 239 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1\u001b[0m.27/stable" 60% 28.9MB/s 2.47' |
| 240 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.2\u001b[0m7/stable" 62% 29.0MB/s 2.35' |
| 241 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27\u001b[0m/stable" 63% 29.1MB/s 2.23' |
| 242 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/s\u001b[0mtable" 65% 29.2MB/s 2.10' |
| 243 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/st\u001b[0mable" 67% 29.4MB/s 1.97' |
| 244 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stab\u001b[0mle" 69% 29.5MB/s 1.85' |
| 245 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stabl\u001b[0me" 71% 29.5MB/s 1.74' |
| 246 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stable"\u001b[0m 73% 29.7MB/s 1.59' |
| 247 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stable" \u001b[0m 75% 29.8MB/s 1.48' |
| 248 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stable" \u001b[0m 77% 29.8MB/s 1.37' |
| 249 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stable" 7\u001b[0m9% 29.9MB/s 1.26' |
| 250 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stable" 81\u001b[0m% 30.0MB/s 1.14' |
| 251 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stable" 83% \u001b[0m30.1MB/s 1.01' |
| 252 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stable" 84% 3\u001b[0m0.1MB/s 919m' |
| 253 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stable" 86% 30.\u001b[0m1MB/s 810m' |
| 254 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stable" 88% 30.2\u001b[0mMB/s 676m' |
| 255 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stable" 91% 30.3MB\u001b[0m/s 555m' |
| 256 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stable" 93% 30.4MB/s\u001b[0m 436m' |
| 257 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stable" 95% 30.5MB/s \u001b[0m317m' |
| 258 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stable" 96% 30.5MB/s 21\u001b[0m1m' |
| 259 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stable" 98% 30.5MB/s 117\u001b[0mm' |
| 260 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stable" 100% 30.5MB/s 11m\u001b[0m' |
| 261 |
'\r\u001b[7mDownload snap "kubectl" (5372) from channel "1.27/stable" 100% 30.0MB/s 0.0ns\u001b[0' |
| 262 |
'\rFetch and check assertions for snap "kubectl" (5372) ' |
| 263 |
'\rMount snap "kubectl" (5372) \\' |
| 264 |
'\rMount snap "kubectl" (5372) ' |
| 265 |
'\rMount snap "kubectl" (5372) ' |
| 266 |
'\rMount snap "kubectl" (5372) ' |
| 267 |
'\rSetup snap "kubectl" (5372) security profiles \\' |
| 268 |
'\rSetup snap "kubectl" (5372) security profiles ' |
| 269 |
'\rSetup snap "kubectl" (5372) security profiles ' |
| 270 |
'\rSetup snap "kubectl" (5372) security profiles ' |
| 271 |
'\rSetup snap "kubectl" (5372) security profiles \\' |
| 272 |
'\rSetup snap "kubectl" (5372) security profiles ' |
| 273 |
'\rSetup snap "kubectl" (5372) security profiles ' |
| 274 |
'\rSetup snap "kubectl" (5372) security profiles ' |
| 275 |
'\rSetup snap "kubectl" (5372) security profiles \\' |
| 276 |
'\rSetup snap "kubectl" (5372) security profiles ' |
| 277 |
'\rSetup snap "kubectl" (5372) security profiles ' |
| 278 |
'\rRun install hook of "kubectl" snap if present ' |
| 279 |
'\rRun install hook of "kubectl" snap if present \\' |
| 280 |
'\rRun install hook of "kubectl" snap if present ' |
| 281 |
'\rRun install hook of "kubectl" snap if present ' |
| 282 |
'\rRun install hook of "kubectl" snap if present ' |
| 283 |
'\rRun install hook of "kubectl" snap if present \\' |
| 284 |
'\rRun install hook of "kubectl" snap if present ' |
| 285 |
'\rRun install hook of "kubectl" snap if present ' |
| 286 |
'\rRun install hook of "kubectl" snap if present ' |
| 287 |
'\rRun install hook of "kubectl" snap if present \\' |
| 288 |
'\rRun install hook of "kubectl" snap if present ' |
| 289 |
'\rRun install hook of "kubectl" snap if present ' |
| 290 |
'\rRun install hook of "kubectl" snap if present ' |
| 291 |
'\rRun install hook of "kubectl" snap if present \\' |
| 292 |
'\rRun install hook of "kubectl" snap if present ' |
| 293 |
'\rRun install hook of "kubectl" snap if present ' |
| 294 |
'\rRun install hook of "kubectl" snap if present ' |
| 295 |
'\rRun install hook of "kubectl" snap if present \\' |
| 296 |
'\rRun install hook of "kubectl" snap if present ' |
| 297 |
'\rRun install hook of "kubectl" snap if present ' |
| 298 |
'\rRun install hook of "kubectl" snap if present ' |
| 299 |
'\rRun install hook of "kubectl" snap if present \\' |
| 300 |
'\rRun install hook of "kubectl" snap if present ' |
| 301 |
'\rRun install hook of "kubectl" snap if present ' |
| 302 |
'\rRun install hook of "kubectl" snap if present ' |
| 303 |
'\rRun install hook of "kubectl" snap if present \\' |
| 304 |
'\rRun install hook of "kubectl" snap if present ' |
| 305 |
'\rRun install hook of "kubectl" snap if present ' |
| 306 |
'\rRun install hook of "kubectl" snap if present ' |
| 307 |
'\rRun install hook of "kubectl" snap if present \\' |
| 308 |
'\rRun install hook of "kubectl" snap if present ' |
| 309 |
'\rRun install hook of "kubectl" snap if present ' |
| 310 |
'\rRun install hook of "kubectl" snap if present ' |
| 311 |
'\rRun install hook of "kubectl" snap if present \\' |
| 312 |
'\rRun install hook of "kubectl" snap if present ' |
| 313 |
'\rRun install hook of "kubectl" snap if present ' |
| 314 |
'\rRun install hook of "kubectl" snap if present ' |
| 315 |
'\rRun install hook of "kubectl" snap if present \\' |
| 316 |
'\rRun install hook of "kubectl" snap if present ' |
| 317 |
'\rRun install hook of "kubectl" snap if present ' |
| 318 |
'\rRun install hook of "kubectl" snap if present ' |
| 319 |
'\rRun install hook of "kubectl" snap if present \\' |
| 320 |
'\rRun install hook of "kubectl" snap if present ' |
| 321 |
'\rRun install hook of "kubectl" snap if present ' |
| 322 |
'\rRun install hook of "kubectl" snap if present ' |
| 323 |
'\rRun install hook of "kubectl" snap if present \\' |
| 324 |
'\rRun install hook of "kubectl" snap if present ' |
| 325 |
'\rRun install hook of "kubectl" snap if present ' |
| 326 |
'\rRun install hook of "kubectl" snap if present ' |
| 327 |
'\rRun install hook of "kubectl" snap if present \\' |
| 328 |
'\rRun install hook of "kubectl" snap if present ' |
| 329 |
'\rRun install hook of "kubectl" snap if present ' |
| 330 |
'\rRun install hook of "kubectl" snap if present ' |
| 331 |
'\rRun install hook of "kubectl" snap if present \\' |
| 332 |
'\rRun install hook of "kubectl" snap if present ' |
| 333 |
'\rRun install hook of "kubectl" snap if present ' |
| 334 |
'\rRun install hook of "kubectl" snap if present ' |
| 335 |
'\rStart snap "kubectl" (5372) services \\' |
| 336 |
'\rStart snap "kubectl" (5372) services ' |
| 337 |
'\rStart snap "kubectl" (5372) services ' |
| 338 |
'\rStart snap "kubectl" (5372) services ' |
| 339 |
'\rStart snap "kubectl" (5372) services \\' |
| 340 |
'\rStart snap "kubectl" (5372) services ' |
| 341 |
'\rStart snap "kubectl" (5372) services ' |
| 342 |
'\rStart snap "kubectl" (5372) services ' |
| 343 |
'\rStart snap "kubectl" (5372) services \\' |
| 344 |
'\rStart snap "kubectl" (5372) services ' |
| 345 |
'\rStart snap "kubectl" (5372) services ' |
| 346 |
'\rStart snap "kubectl" (5372) services ' |
| 347 |
'\rStart snap "kubectl" (5372) services \\' |
| 348 |
'\rStart snap "kubectl" (5372) services ' |
| 349 |
'\rStart snap "kubectl" (5372) services ' |
| 350 |
'\rStart snap "kubectl" (5372) services ' |
| 351 |
'\rStart snap "kubectl" (5372) services \\' |
| 352 |
'\rRun configure hook of "kubectl" snap if present ' |
| 353 |
'\rRun configure hook of "kubectl" snap if present ' |
| 354 |
'\rRun configure hook of "kubectl" snap if present ' |
| 355 |
'\rRun configure hook of "kubectl" snap if present \\' |
| 356 |
'\rRun configure hook of "kubectl" snap if present ' |
| 357 |
'\rRun configure hook of "kubectl" snap if present ' |
| 358 |
'\rRun configure hook of "kubectl" snap if present ' |
| 359 |
'\rRun configure hook of "kubectl" snap if present \\' |
| 360 |
'\rRun configure hook of "kubectl" snap if present ' |
| 361 |
'\rRun configure hook of "kubectl" snap if present ' |
| 362 |
'\rRun configure hook of "kubectl" snap if present ' |
| 363 |
'\rRun configure hook of "kubectl" snap if present \\' |
| 364 |
'\rRun configure hook of "kubectl" snap if present ' |
| 365 |
'\rRun configure hook of "kubectl" snap if present ' |
| 366 |
'\rRun configure hook of "kubectl" snap if present ' |
| 367 |
'\rRun configure hook of "kubectl" snap if present \\' |
| 368 |
'\rRun configure hook of "kubectl" snap if present ' |
| 369 |
'\rRun configure hook of "kubectl" snap if present ' |
| 370 |
'\rRun configure hook of "kubectl" snap if present ' |
| 371 |
'\rRun configure hook of "kubectl" snap if present \\' |
| 372 |
'\rRun configure hook of "kubectl" snap if present ' |
| 373 |
'\rRun service command "restart" for services ["daemon-apiserver-proxy"] of snap "' |
| 374 |
"\r\u001b[0m\u001b[?25h\u001b[Kkubectl (1.27/stable) v1.27.2 from Canonical** installed\n" |
| 375 |
) |
| 376 |
|
| 377 |
|
| 378 |
default_env = {"environ_update": {"LANGUAGE": "C", "LC_ALL": "C"}, "check_rc": False} |
| 379 |
default_version_out = """\ |
| 380 |
snap 2.66.1+24.04 |
| 381 |
snapd 2.66.1+24.04 |
| 382 |
series 16 |
| 383 |
ubuntu 24.04 |
| 384 |
kernel 6.8.0-49-generic |
| 385 |
""" |
| 386 |
|
| 387 |
TEST_SPEC = dict( |
| 388 |
test_cases=[ |
| 389 |
dict( |
| 390 |
id="simple case", |
| 391 |
input={"name": ["hello-world"]}, |
| 392 |
output=dict(changed=True, snaps_installed=["hello-world"]), |
| 393 |
flags={}, |
| 394 |
mocks=dict( |
| 395 |
run_command=[ |
| 396 |
dict( |
| 397 |
command=["/testbin/snap", "version"], |
| 398 |
environ=default_env, |
| 399 |
rc=0, |
| 400 |
out=default_version_out, |
| 401 |
err="", |
| 402 |
), |
| 403 |
dict( |
| 404 |
command=["/testbin/snap", "info", "hello-world"], |
| 405 |
environ=default_env, |
| 406 |
rc=0, |
| 407 |
out="name: hello-world\n", |
| 408 |
err="", |
| 409 |
), |
| 410 |
dict( |
| 411 |
command=["/testbin/snap", "list"], |
| 412 |
environ=default_env, |
| 413 |
rc=0, |
| 414 |
out="", |
| 415 |
err="", |
| 416 |
), |
| 417 |
dict( |
| 418 |
command=["/testbin/snap", "install", "hello-world"], |
| 419 |
environ=default_env, |
| 420 |
rc=0, |
| 421 |
out="hello-world (12345/stable) v12345 from Canonical** installed\n", |
| 422 |
err="", |
| 423 |
), |
| 424 |
dict( |
| 425 |
command=["/testbin/snap", "list"], |
| 426 |
environ=default_env, |
| 427 |
rc=0, |
| 428 |
out=( |
| 429 |
"Name Version Rev Tracking Publisher Notes" |
| 430 |
"core20 20220826 1623 latest/stable canonical** base" |
| 431 |
"lxd 5.6-794016a 23680 latest/stable/… canonical** -" |
| 432 |
"hello-world 5.6-794016a 23680 latest/stable/… canonical** -" |
| 433 |
"snapd 2.57.4 17336 latest/stable canonical** snapd" |
| 434 |
"" |
| 435 |
), |
| 436 |
err="", |
| 437 |
), |
| 438 |
], |
| 439 |
), |
| 440 |
), |
| 441 |
dict( |
| 442 |
id="set_system_option", |
| 443 |
input={"name": ["system"], "options": ["proxy.http=http://proxy.example.com:3128/"]}, |
| 444 |
output=dict(changed=True, options_changed=["system:proxy.http=http://proxy.example.com:3128/"]), |
| 445 |
flags={}, |
| 446 |
mocks=dict( |
| 447 |
run_command=[ |
| 448 |
dict( |
| 449 |
command=["/testbin/snap", "version"], |
| 450 |
environ=default_env, |
| 451 |
rc=0, |
| 452 |
out=default_version_out, |
| 453 |
err="", |
| 454 |
), |
| 455 |
# No "snap info system" — virtual snap bypasses names_from_snaps |
| 456 |
dict( |
| 457 |
command=["/testbin/snap", "list"], |
| 458 |
environ=default_env, |
| 459 |
rc=0, |
| 460 |
out="", |
| 461 |
err="", |
| 462 |
), |
| 463 |
dict( |
| 464 |
command=["/testbin/snap", "get", "-d", "system"], |
| 465 |
environ=default_env, |
| 466 |
rc=0, |
| 467 |
out="{}", |
| 468 |
err="", |
| 469 |
), |
| 470 |
dict( |
| 471 |
command=["/testbin/snap", "set", "system", "proxy.http=http://proxy.example.com:3128/"], |
| 472 |
environ=default_env, |
| 473 |
rc=0, |
| 474 |
out="", |
| 475 |
err="", |
| 476 |
), |
| 477 |
dict( |
| 478 |
command=["/testbin/snap", "list"], |
| 479 |
environ=default_env, |
| 480 |
rc=0, |
| 481 |
out="", |
| 482 |
err="", |
| 483 |
), |
| 484 |
], |
| 485 |
), |
| 486 |
), |
| 487 |
dict( |
| 488 |
id="set_system_option_idempotent", |
| 489 |
input={"name": ["system"], "options": ["proxy.http=http://proxy.example.com:3128/"]}, |
| 490 |
output=dict(changed=False), |
| 491 |
flags={}, |
| 492 |
mocks=dict( |
| 493 |
run_command=[ |
| 494 |
dict( |
| 495 |
command=["/testbin/snap", "version"], |
| 496 |
environ=default_env, |
| 497 |
rc=0, |
| 498 |
out=default_version_out, |
| 499 |
err="", |
| 500 |
), |
| 501 |
dict( |
| 502 |
command=["/testbin/snap", "list"], |
| 503 |
environ=default_env, |
| 504 |
rc=0, |
| 505 |
out="", |
| 506 |
err="", |
| 507 |
), |
| 508 |
dict( |
| 509 |
command=["/testbin/snap", "get", "-d", "system"], |
| 510 |
environ=default_env, |
| 511 |
rc=0, |
| 512 |
out='{"proxy": {"http": "http://proxy.example.com:3128/"}}', |
| 513 |
err="", |
| 514 |
), |
| 515 |
dict( |
| 516 |
command=["/testbin/snap", "list"], |
| 517 |
environ=default_env, |
| 518 |
rc=0, |
| 519 |
out="", |
| 520 |
err="", |
| 521 |
), |
| 522 |
], |
| 523 |
), |
| 524 |
), |
| 525 |
dict( |
| 526 |
id="issue_6803", |
| 527 |
input={"name": ["microk8s", "kubectl"], "classic": True}, |
| 528 |
output=dict(changed=True, snaps_installed=["microk8s", "kubectl"]), |
| 529 |
flags={}, |
| 530 |
mocks=dict( |
| 531 |
run_command=[ |
| 532 |
dict( |
| 533 |
command=["/testbin/snap", "version"], |
| 534 |
environ=default_env, |
| 535 |
rc=0, |
| 536 |
out=default_version_out, |
| 537 |
err="", |
| 538 |
), |
| 539 |
dict( |
| 540 |
command=["/testbin/snap", "info", "microk8s", "kubectl"], |
| 541 |
environ=default_env, |
| 542 |
rc=0, |
| 543 |
out="name: microk8s\n---\nname: kubectl\n", |
| 544 |
err="", |
| 545 |
), |
| 546 |
dict( |
| 547 |
command=["/testbin/snap", "list"], |
| 548 |
environ=default_env, |
| 549 |
rc=0, |
| 550 |
out=issue_6803_status_out, |
| 551 |
err="", |
| 552 |
), |
| 553 |
dict( |
| 554 |
command=["/testbin/snap", "install", "--classic", "microk8s"], |
| 555 |
environ=default_env, |
| 556 |
rc=0, |
| 557 |
out=issue_6803_microk8s_out, |
| 558 |
err="", |
| 559 |
), |
| 560 |
dict( |
| 561 |
command=["/testbin/snap", "install", "--classic", "kubectl"], |
| 562 |
environ=default_env, |
| 563 |
rc=0, |
| 564 |
out=issue_6803_kubectl_out, |
| 565 |
err="", |
| 566 |
), |
| 567 |
dict( |
| 568 |
command=["/testbin/snap", "list"], |
| 569 |
environ=default_env, |
| 570 |
rc=0, |
| 571 |
out=( |
| 572 |
"Name Version Rev Tracking Publisher Notes" |
| 573 |
"core20 20220826 1623 latest/stable canonical** base" |
| 574 |
"lxd 5.6-794016a 23680 latest/stable/… canonical** -" |
| 575 |
"microk8s 5.6-794016a 23680 latest/stable/… canonical** -" |
| 576 |
"kubectl 5.6-794016a 23680 latest/stable/… canonical** -" |
| 577 |
"snapd 2.57.4 17336 latest/stable canonical** snapd" |
| 578 |
"" |
| 579 |
), |
| 580 |
err="", |
| 581 |
), |
| 582 |
], |
| 583 |
), |
| 584 |
), |
| 585 |
] |
| 586 |
) |
| 587 |
|
| 588 |
UTHelper.from_spec(snap, sys.modules[__name__], TEST_SPEC, mocks=[RunCommandMock]) |