MCPcopy
hub / github.com/etcd-io/bbolt / TestRestartFromPowerFailureXFS

Function TestRestartFromPowerFailureXFS

tests/robustness/powerfailure_test.go:86–140  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

84}
85
86func TestRestartFromPowerFailureXFS(t *testing.T) {
87 for _, tc := range []struct {
88 name string
89 mkfsOpt string
90 fsMountOpt string
91 useFailpoint bool
92 }{
93 {
94 name: "xfs_no_opts",
95 mkfsOpt: "",
96 fsMountOpt: "",
97 useFailpoint: true,
98 },
99 {
100 name: "lazy-log",
101 mkfsOpt: "-l lazy-count=1",
102 fsMountOpt: "",
103 useFailpoint: true,
104 },
105 {
106 name: "odd-allocsize",
107 mkfsOpt: "",
108 fsMountOpt: "allocsize=" + fmt.Sprintf("%d", 4096*5),
109 useFailpoint: true,
110 },
111 {
112 name: "nolargeio",
113 mkfsOpt: "",
114 fsMountOpt: "nolargeio",
115 useFailpoint: true,
116 },
117 {
118 name: "odd-alignment",
119 mkfsOpt: "-d sunit=1024,swidth=1024",
120 fsMountOpt: "noalign",
121 useFailpoint: true,
122 },
123 {
124 name: "openshift-sno-options",
125 mkfsOpt: "-m bigtime=1,finobt=1,rmapbt=0,reflink=1 -i sparse=1 -l lazy-count=1",
126 // openshift also supplies seclabel,relatime,prjquota on RHEL, but that's not supported on our CI
127 // prjquota is only unsupported on our ARM runners.
128 // You can find more information in either the man page with `man xfs` or `man mkfs.xfs`.
129 // Also refer to https://man7.org/linux/man-pages/man8/mkfs.xfs.8.html.
130 fsMountOpt: "rw,attr2,inode64,logbufs=8,logbsize=32k",
131 useFailpoint: true,
132 },
133 } {
134 t.Run(tc.name, func(t *testing.T) {
135 t.Logf("mkfs opts: %s", tc.mkfsOpt)
136 t.Logf("mount opts: %s", tc.fsMountOpt)
137 doPowerFailure(t, 5*time.Second, dmflakey.FSTypeXFS, tc.mkfsOpt, tc.fsMountOpt, tc.useFailpoint)
138 })
139 }
140}
141
142func doPowerFailure(t *testing.T, du time.Duration, fsType dmflakey.FSType, mkfsOpt string, fsMountOpt string, useFailpoint bool) {
143 flakey := initFlakeyDevice(t, strings.ReplaceAll(t.Name(), "/", "_"), fsType, mkfsOpt, fsMountOpt)

Callers

nothing calls this directly

Calls 2

doPowerFailureFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected