github.com/Lephar/snapd@v0.0.0-20210825215435-c7fba9cef4d2/seed/seedtest/sample.go (about) 1 // -*- Mode: Go; indent-tabs-mode: t -*- 2 3 /* 4 * Copyright (C) 2015-2019 Canonical Ltd 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 3 as 8 * published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 package seedtest 21 22 var SampleSnapYaml = map[string]string{ 23 "core": `name: core 24 type: os 25 version: 1.0 26 `, 27 "pc-kernel": `name: pc-kernel 28 type: kernel 29 version: 1.0 30 `, 31 "pc": `name: pc 32 type: gadget 33 version: 1.0 34 `, 35 "classic-gadget": `name: classic-gadget 36 version: 1.0 37 type: gadget 38 `, 39 "required": `name: required 40 type: app 41 version: 1.0 42 `, 43 "classic-snap": `name: classic-snap 44 type: app 45 confinement: classic 46 version: 1.0 47 `, 48 "snapd": `name: snapd 49 type: snapd 50 version: 1.0 51 `, 52 "core18": `name: core18 53 type: base 54 version: 1.0 55 `, 56 "pc-kernel=18": `name: pc-kernel 57 type: kernel 58 version: 1.0 59 `, 60 "pc=18": `name: pc 61 type: gadget 62 base: core18 63 version: 1.0 64 `, 65 "classic-gadget18": `name: classic-gadget18 66 version: 1.0 67 base: core18 68 type: gadget 69 `, 70 "required18": `name: required18 71 type: app 72 base: core18 73 version: 1.0 74 `, 75 "core20": `name: core20 76 type: base 77 version: 1.0 78 `, 79 "pc-kernel=20": `name: pc-kernel 80 type: kernel 81 version: 1.0 82 `, 83 "pc=20": `name: pc 84 type: gadget 85 base: core20 86 version: 1.0 87 `, 88 "required20": `name: required20 89 type: app 90 base: core20 91 version: 1.0 92 `, 93 "optional20-a": `name: optional20-a 94 type: app 95 base: core20 96 version: 1.0 97 `, 98 "optional20-b": `name: optional20-b 99 type: app 100 base: core20 101 version: 1.0`, 102 "uboot-gadget=20": `name: uboot-gadget 103 type: gadget 104 base: core20 105 version: 1.0 106 `, 107 "arm-kernel=20": `name: arm-kernel 108 type: kernel 109 version: 1.0 110 `, 111 "test-devmode=20": `name: test-devmode 112 type: app 113 base: core20 114 version: 1.0 115 confinement: devmode 116 `, 117 } 118 119 func MergeSampleSnapYaml(snapYaml ...map[string]string) map[string]string { 120 if len(snapYaml) == 0 { 121 return nil 122 } 123 merged := make(map[string]string, len(snapYaml[0])) 124 for _, m := range snapYaml { 125 for yamlKey, yaml := range m { 126 merged[yamlKey] = yaml 127 } 128 } 129 return merged 130 }