Skip to content

Commit 39cb55c

Browse files
committed
complete rfc code of config.md
Signed-off-by: Liang Chenye <liangchenye@huawei.com>
1 parent 12b47b9 commit 39cb55c

1 file changed

Lines changed: 152 additions & 1 deletion

File tree

error/runtime_spec.go

Lines changed: 152 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const (
3030
RootOnNonHyperV
3131
// RootOnHyperV represents the error code of root setting test on hyper-v containers
3232
RootOnHyperV
33-
// PathFormatOnWindows represents the error code of the path format test on Window
33+
// PathFormatOnWindows represents the error code of the path format test on Windows
3434
PathFormatOnWindows
3535
// PathName represents the error code of the path name test
3636
PathName
@@ -41,6 +41,73 @@ const (
4141
// ReadonlyOnWindows represents the error code of readonly setting test on Windows
4242
ReadonlyOnWindows
4343

44+
// MountInOrder represents the error code of order test of mount list
45+
MountInOrder
46+
// MountDestinationAbs represents the error code of absolute path test of mount destination
47+
MountDestinationAbs
48+
// MountNotNestedOnWindows represents the error code of nested mount point on Windows
49+
MountNotNestedOnWindows
50+
// MountROSupportOnWindows represents the error code of RO test on Windows
51+
MountROSupportOnWindows
52+
53+
// Process
54+
// ProcessOnStart represents the error code of process property test when 'start' is called
55+
ProcessOnStart
56+
// ProcessIngnoreConsoleSize represents the error code of console size test when terminal is `false` or unset
57+
ProcessIgnoreConsoleSize
58+
// ProcessCWDAbs represents the error code of absolute path test of process `cwd`
59+
ProcessCWDAbs
60+
61+
// PosixProcess
62+
// RlimitType represents the error code of rlimit type test
63+
RlimitType
64+
// RlimitSoftCur represents the error code of rlimit soft test
65+
RlimitSoftCur
66+
// RlimitHardMax represents the error code of rlimit hard test
67+
RlimitHardMax
68+
// RlimitDuplicated represents the error code of rlimit duplicate type test
69+
RlimitDuplicated
70+
71+
// LinuxProcess
72+
// LinuxCapabilityMap represents the error code of capability map test
73+
LinuxCapabilityMap
74+
// LinuxOomScoreAdj represents the error code of `oom_score_adj` value test when it is set
75+
LinuxOomScoreAdj
76+
// LinuxNoOomScoreAdj represents the error code of `oom_score_adj` value test when it is not set
77+
LinuxNoOomScoreAdj
78+
79+
// Platform-specific configuration
80+
// WindowsPlatform represents the error code of windows config test on Windows platform
81+
WindowsPlatform
82+
83+
// POSIX-platform Hooks
84+
// PosixHookPathAbs represents the error code of absolute path test of posix hook path
85+
PosixHookPathAbs
86+
// PosixHookTimeout represents the error code of hook timeout test
87+
PosixHookTimeout
88+
// PosixHookCalledInOrder represents the error code of order test of called hooks
89+
PosixHookCalledInOrder
90+
// PosixHookStateOverStdin represents the error code of `state` information test if it was passed to hook process
91+
PosixHookStateOverStdin
92+
// PosixHookPrestartOrder represents the error code of order test of pre-start hook
93+
PosixHookPrestartOrder
94+
// PosixHookPoststartOrder represents the error code of order test of post-start hook
95+
PosixHookPoststartOrder
96+
// PosixHookPoststopOrder represents the error code of order test of post-stop hook
97+
PosixHookPoststopOrder
98+
99+
// Annotations
100+
// AnnotationKeyValue represents the error code of annotations key-value map test
101+
AnnotationKeyValue
102+
103+
// Extensibility
104+
// IgnoreUnknownProperties represents the error code of unknown properties test
105+
IgnoreUnknownProperties
106+
107+
// Valid values
108+
// ValidValues represents the error code of invalid or unsupported value test
109+
ValidValues
110+
44111
// DefaultFilesystems represents the error code of default filesystems test
45112
DefaultFilesystems
46113

@@ -67,6 +134,42 @@ var (
67134
rootRef = func(version string) (reference string, err error) {
68135
return fmt.Sprintf(referenceTemplate, version, "config.md#root"), nil
69136
}
137+
mountsRef = func(version string) (reference string, err error) {
138+
return fmt.Sprintf(referenceTemplate, version, "config.md#mounts"), nil
139+
}
140+
processRef = func(version string) (reference string, err error) {
141+
return fmt.Sprintf(referenceTemplate, version, "config.md#process"), nil
142+
}
143+
posixProcessRef = func(version string) (reference string, err error) {
144+
return fmt.Sprintf(referenceTemplate, version, "config.md#posix-process"), nil
145+
}
146+
linuxProcessRef = func(version string) (reference string, err error) {
147+
return fmt.Sprintf(referenceTemplate, version, "config.md#linux-process"), nil
148+
}
149+
platformRef = func(version string) (reference string, err error) {
150+
return fmt.Sprintf(referenceTemplate, version, "config.md#platform-specific-configuration"), nil
151+
}
152+
posixHookRef = func(version string) (reference string, err error) {
153+
return fmt.Sprintf(referenceTemplate, version, "config.md#posix-platform-hooks"), nil
154+
}
155+
prestartRef = func(version string) (reference string, err error) {
156+
return fmt.Sprintf(referenceTemplate, version, "config.md#prestart"), nil
157+
}
158+
poststartRef = func(version string) (reference string, err error) {
159+
return fmt.Sprintf(referenceTemplate, version, "config.md#poststart"), nil
160+
}
161+
poststopRef = func(version string) (reference string, err error) {
162+
return fmt.Sprintf(referenceTemplate, version, "config.md#poststop"), nil
163+
}
164+
annotationsRef = func(version string) (reference string, err error) {
165+
return fmt.Sprintf(referenceTemplate, version, "config.md#annotations"), nil
166+
}
167+
extensibilityRef = func(version string) (reference string, err error) {
168+
return fmt.Sprintf(referenceTemplate, version, "config.md#extensibility"), nil
169+
}
170+
validValuesRef = func(version string) (reference string, err error) {
171+
return fmt.Sprintf(referenceTemplate, version, "config.md#valid-values"), nil
172+
}
70173
defaultFSRef = func(version string) (reference string, err error) {
71174
return fmt.Sprintf(referenceTemplate, version, "config-linux.md#default-filesystems"), nil
72175
}
@@ -94,6 +197,54 @@ var ociErrors = map[SpecErrorCode]errorTemplate{
94197
ReadonlyFilesystem: {Level: Must, Reference: rootRef},
95198
ReadonlyOnWindows: {Level: Must, Reference: rootRef},
96199

200+
// Mounts
201+
// TODO: add tests for 'MountInOrder'
202+
MountInOrder: {Level: Must, Reference: mountsRef},
203+
MountDestinationAbs: {Level: Must, Reference: mountsRef},
204+
MountNotNestedOnWindows: {Level: Must, Reference: mountsRef},
205+
// TODO: add tests for 'MountROSupportOnWindows'
206+
MountROSupportOnWindows: {Level: Must, Reference: mountsRef},
207+
208+
// Process
209+
ProcessOnStart: {Level: Required, Reference: processRef},
210+
ProcessIgnoreConsoleSize: {Level: Must, Reference: processRef},
211+
ProcessCWDAbs: {Level: Must, Reference: processRef},
212+
213+
// PosixProcess
214+
RlimitType: {Level: Must, Reference: posixProcessRef},
215+
RlimitSoftCur: {Level: Must, Reference: posixProcessRef},
216+
RlimitHardMax: {Level: Must, Reference: posixProcessRef},
217+
RlimitDuplicated: {Level: Must, Reference: posixProcessRef},
218+
219+
// LinuxProcess
220+
LinuxCapabilityMap: {Level: Must, Reference: linuxProcessRef},
221+
LinuxOomScoreAdj: {Level: Must, Reference: linuxProcessRef},
222+
LinuxNoOomScoreAdj: {Level: Must, Reference: linuxProcessRef},
223+
224+
// Platform-specific configuration
225+
WindowsPlatform: {Level: Must, Reference: platformRef},
226+
227+
// POSIX-platform Hooks
228+
PosixHookPathAbs: {Level: Must, Reference: posixHookRef},
229+
PosixHookTimeout: {Level: Must, Reference: posixHookRef},
230+
PosixHookCalledInOrder: {Level: Must, Reference: posixHookRef},
231+
PosixHookStateOverStdin: {Level: Must, Reference: posixHookRef},
232+
233+
PosixHookPrestartOrder: {Level: Must, Reference: prestartRef},
234+
PosixHookPoststartOrder: {Level: Must, Reference: poststartRef},
235+
PosixHookPoststopOrder: {Level: Must, Reference: poststopRef},
236+
237+
// Annotations
238+
// TODO: add tests for 'AnnotationKeyValue'
239+
AnnotationKeyValue: {Level: Must, Reference: annotationsRef},
240+
241+
// Extensibility
242+
// TODO: add tests for 'IgnoreUnknownProperties'
243+
IgnoreUnknownProperties: {Level: Must, Reference: extensibilityRef},
244+
245+
// Valid values
246+
ValidValues: {Level: Must, Reference: validValuesRef},
247+
97248
// Config-Linux.md
98249
// Default Filesystems
99250
DefaultFilesystems: {Level: Should, Reference: defaultFSRef},

0 commit comments

Comments
 (0)