A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/orgrim/pg_back/commit/b942f68c9f1477432f6b31c39384ccf9e61a5166 below:

force legacy timestamp format on windows · orgrim/pg_back@b942f68 · GitHub

@@ -33,6 +33,7 @@ import (

33 33

"github.com/spf13/pflag"

34 34

"io/ioutil"

35 35

"os"

36 +

"runtime"

36 37

"testing"

37 38

"time"

38 39

)

@@ -117,6 +118,11 @@ func TestValidatePurgeTimeLimitValue(t *testing.T) {

117 118

}

118 119 119 120

func TestDefaultOptions(t *testing.T) {

121 +

timeFormat := time.RFC3339

122 +

if runtime.GOOS == "windows" {

123 +

timeFormat = "2006-01-02_15-04-05"

124 +

}

125 + 120 126

var want = options{

121 127

Directory: "/var/backups/postgresql",

122 128

Format: 'c',

@@ -128,7 +134,7 @@ func TestDefaultOptions(t *testing.T) {

128 134

PurgeKeep: 0,

129 135

SumAlgo: "none",

130 136

CfgFile: "/etc/pg_back/pg_back.conf",

131 -

TimeFormat: time.RFC3339,

137 +

TimeFormat: timeFormat,

132 138

}

133 139 134 140

got := defaultOptions()

@@ -139,6 +145,10 @@ func TestDefaultOptions(t *testing.T) {

139 145

}

140 146 141 147

func TestParseCli(t *testing.T) {

148 +

timeFormat := time.RFC3339

149 +

if runtime.GOOS == "windows" {

150 +

timeFormat = "2006-01-02_15-04-05"

151 +

}

142 152

var (

143 153

defaults = defaultOptions()

144 154

tests = []struct {

@@ -162,7 +172,7 @@ func TestParseCli(t *testing.T) {

162 172

PurgeKeep: 0,

163 173

SumAlgo: "none",

164 174

CfgFile: "/etc/pg_back/pg_back.conf",

165 -

TimeFormat: time.RFC3339,

175 +

TimeFormat: timeFormat,

166 176

},

167 177

false,

168 178

false,

@@ -182,7 +192,7 @@ func TestParseCli(t *testing.T) {

182 192

PurgeKeep: 0,

183 193

SumAlgo: "none",

184 194

CfgFile: "/etc/pg_back/pg_back.conf",

185 -

TimeFormat: time.RFC3339,

195 +

TimeFormat: timeFormat,

186 196

},

187 197

false,

188 198

false,

@@ -258,6 +268,11 @@ func TestParseCli(t *testing.T) {

258 268

}

259 269 260 270

func TestLoadConfigurationFile(t *testing.T) {

271 +

timeFormat := time.RFC3339

272 +

if runtime.GOOS == "windows" {

273 +

timeFormat = "2006-01-02_15-04-05"

274 +

}

275 + 261 276

var tests = []struct {

262 277

params []string

263 278

fail bool

@@ -278,7 +293,7 @@ func TestLoadConfigurationFile(t *testing.T) {

278 293

PurgeKeep: 0,

279 294

SumAlgo: "none",

280 295

CfgFile: "/etc/pg_back/pg_back.conf",

281 -

TimeFormat: time.RFC3339,

296 +

TimeFormat: timeFormat,

282 297

},

283 298

},

284 299

{ // ensure comma separated lists work

@@ -296,7 +311,7 @@ func TestLoadConfigurationFile(t *testing.T) {

296 311

PurgeKeep: 0,

297 312

SumAlgo: "none",

298 313

CfgFile: "/etc/pg_back/pg_back.conf",

299 -

TimeFormat: time.RFC3339,

314 +

TimeFormat: timeFormat,

300 315

},

301 316

},

302 317

{

@@ -313,7 +328,7 @@ func TestLoadConfigurationFile(t *testing.T) {

313 328

PurgeKeep: 0,

314 329

SumAlgo: "none",

315 330

CfgFile: "/etc/pg_back/pg_back.conf",

316 -

TimeFormat: time.RFC3339,

331 +

TimeFormat: timeFormat,

317 332

},

318 333

},

319 334

{

@@ -365,7 +380,7 @@ func TestLoadConfigurationFile(t *testing.T) {

365 380

PurgeKeep: 0,

366 381

SumAlgo: "none",

367 382

CfgFile: "/etc/pg_back/pg_back.conf",

368 -

TimeFormat: time.RFC3339,

383 +

TimeFormat: timeFormat,

369 384

PgDumpOpts: []string{"-O", "-x"},

370 385

PerDbOpts: map[string]*dbOpts{"db": &dbOpts{

371 386

Format: 'c',

@@ -402,7 +417,7 @@ func TestLoadConfigurationFile(t *testing.T) {

402 417

PurgeKeep: 0,

403 418

SumAlgo: "none",

404 419

CfgFile: "/etc/pg_back/pg_back.conf",

405 -

TimeFormat: time.RFC3339,

420 +

TimeFormat: timeFormat,

406 421

PgDumpOpts: []string{"-O", "-x"},

407 422

PerDbOpts: map[string]*dbOpts{"db": &dbOpts{

408 423

Format: 'c',

@@ -450,6 +465,11 @@ func TestLoadConfigurationFile(t *testing.T) {

450 465

}

451 466 452 467

func TestMergeCliAndConfigoptions(t *testing.T) {

468 +

timeFormat := time.RFC3339

469 +

if runtime.GOOS == "windows" {

470 +

timeFormat = "2006-01-02_15-04-05"

471 +

}

472 + 453 473

want := options{

454 474

BinDirectory: "/bin",

455 475

Directory: "test",

@@ -471,7 +491,7 @@ func TestMergeCliAndConfigoptions(t *testing.T) {

471 491

PreHook: "touch /tmp/pre-hook",

472 492

PostHook: "touch /tmp/post-hook",

473 493

CfgFile: "/etc/pg_back/pg_back.conf",

474 -

TimeFormat: time.RFC3339,

494 +

TimeFormat: timeFormat,

475 495

}

476 496 477 497

cliOptList := []string{


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4