From 0738cfbbdbbf898d9e864970924e59d0a2af45e3 Mon Sep 17 00:00:00 2001 From: Sandro Jäckel Date: Tue, 10 Nov 2026 18:03:37 +0100 Subject: Fix that Ceph Swift API emulation contains timezone --- iterator_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 iterator_test.go (limited to 'iterator_test.go') diff --git a/iterator_test.go b/iterator_test.go new file mode 100644 index 0000000..6ea8599 --- /dev/null +++ b/iterator_test.go @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: 2026 Stefan Majewsky +// SPDX-License-Identifier: Apache-2.0 + +package schwift + +import ( + "testing" + "time" +) + +func TestParseSwiftLastModified(t *testing.T) { + want := time.Date(2026, time.November, 10, 15, 37, 37, 707_000_000, time.UTC) + for _, input := range []string{ + "2026-11-10T15:37:37.707", // Swift's timezone-less format + "2026-11-10T15:37:37.707Z", // UTC timezone + "2026-11-10T16:37:37.707+01:00", // Explicit offset + } { + t.Run(input, func(t *testing.T) { + got, err := parseSwiftLastModified(input) + if err != nil { + t.Fatalf("parseSwiftLastModified(%q) returned an error: %v", input, err) + } + if !got.Equal(want) { + t.Errorf("parseSwiftLastModified(%q) = %s, want %s", input, got, want) + } + }) + } +} -- cgit v1.3.1