-
Notifications
You must be signed in to change notification settings - Fork 392
Expand file tree
/
Copy pathutils.ts
More file actions
127 lines (118 loc) · 3.11 KB
/
utils.ts
File metadata and controls
127 lines (118 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
export const staticProvisionParams = {
workspaceMountConsistency: 'cached' as 'cached',
defaultUserEnvProbe: 'loginInteractiveShell' as 'loginInteractiveShell',
logFormat: 'text' as 'text',
removeExistingContainer: false,
buildNoCache: false,
expectExistingContainer: false,
postCreateEnabled: true,
skipNonBlocking: false,
prebuild: false,
additionalMounts: [],
updateRemoteUserUIDDefault: 'on' as 'on',
additionalCacheFroms: [],
dockerPath: undefined,
dockerComposePath: undefined,
containerDataFolder: undefined,
containerSystemDataFolder: undefined,
configFile: undefined,
overrideConfigFile: undefined,
persistedFolder: undefined,
terminalDimensions: undefined,
useBuildKit: 'auto' as 'auto',
buildxPlatform: undefined,
buildxPush: false,
buildxOutput: undefined,
buildxCacheTo: undefined,
buildxMetadataFile: undefined,
skipPostAttach: false,
};
export const staticExecParams = {
'user-data-folder': undefined,
'docker-path': undefined,
'docker-compose-path': undefined,
'container-data-folder': undefined,
'container-system-data-folder': undefined,
'id-label': undefined,
'config': undefined,
'override-config': undefined,
'terminal-rows': undefined,
'terminal-columns': undefined,
'container-id': undefined,
'mount-workspace-git-root': true,
'log-level': 'info' as 'info',
'log-format': 'text' as 'text',
'default-user-env-probe': 'loginInteractiveShell' as 'loginInteractiveShell',
};
export interface LaunchResult {
disposables?: (() => Promise<unknown> | undefined)[];
containerId: string;
remoteUser?: string;
remoteWorkspaceFolder?: string | undefined;
finishBackgroundTasks?: () => Promise<void>;
containerHost?: string;
containerPort?: any;
}
// dev-container-features-test-lib
export const testLibraryScript = `
#!/bin/bash
SCRIPT_FOLDER="$(cd "$(dirname $0)" && pwd)"
USERNAME=\${1:-root}
if [ -z $HOME ]; then
HOME="/root"
fi
FAILED=()
echoStderr()
{
echo "$@" 1>&2
}
check() {
LABEL=$1
shift
echo -e "\n"
echo -e "🔄 Testing '$LABEL'"
echo -e '\\033[37m'
if "$@"; then
echo -e "\n"
echo "✅ Passed '$LABEL'!"
return 0
else
echo -e "\n"
echoStderr "❌ $LABEL check failed."
FAILED+=("$LABEL")
return 1
fi
}
checkMultiple() {
PASSED=0
LABEL="$1"
echo -e "\n"
echo -e "🔄 Testing '$LABEL'."
shift; MINIMUMPASSED=$1
shift; EXPRESSION="$1"
while [ "$EXPRESSION" != "" ]; do
if $EXPRESSION; then ((PASSED+=1)); fi
shift; EXPRESSION=$1
done
if [ $PASSED -ge $MINIMUMPASSED ]; then
echo -e "\n"
echo "✅ Passed!"
return 0
else
echo -e "\n"
echoStderr "❌ '$LABEL' check failed."
FAILED+=("$LABEL")
return 1
fi
}
reportResults() {
if [ \${#FAILED[@]} -ne 0 ]; then
echo -e "\n"
echoStderr -e "💥 Failed tests: \${FAILED[@]}"
exit 1
else
echo -e "\n"
echo -e "Test Passed!"
exit 0
fi
}`;