• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zalando / postgres-operator / 14453521127

14 Apr 2025 06:58PM UTC coverage: 45.498%. Remained the same
14453521127

Pull #2901

github

web-flow
Merge 4b6fd971e into 68c4b4963
Pull Request #2901: Bump golang.org/x/crypto from 0.31.0 to 0.35.0

7024 of 15438 relevant lines covered (45.5%)

29.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/pkg/cluster/filesystems.go
1
package cluster
2

3
import (
4
        "fmt"
5
        "strings"
6

7
        "github.com/zalando/postgres-operator/pkg/spec"
8
        "github.com/zalando/postgres-operator/pkg/util/constants"
9
        "github.com/zalando/postgres-operator/pkg/util/filesystems"
10
)
11

12
func (c *Cluster) getPostgresFilesystemInfo(podName *spec.NamespacedName) (device, fstype string, err error) {
×
13
        out, err := c.ExecCommand(podName, "bash", "-c", fmt.Sprintf("df -T %s|tail -1", constants.PostgresDataMount))
×
14
        if err != nil {
×
15
                return "", "", err
×
16
        }
×
17
        fields := strings.Fields(out)
×
18
        if len(fields) < 2 {
×
19
                return "", "", fmt.Errorf("too few fields in the df output")
×
20
        }
×
21

22
        return fields[0], fields[1], nil
×
23
}
24

25
func (c *Cluster) resizePostgresFilesystem(podName *spec.NamespacedName, resizers []filesystems.FilesystemResizer) error {
×
26
        // resize2fs always writes to stderr, and ExecCommand considers a non-empty stderr an error
×
27
        // first, determine the device and the filesystem
×
28
        deviceName, fsType, err := c.getPostgresFilesystemInfo(podName)
×
29
        if err != nil {
×
30
                return fmt.Errorf("could not get device and type for the postgres filesystem: %v", err)
×
31
        }
×
32
        for _, resizer := range resizers {
×
33
                if !resizer.CanResizeFilesystem(fsType) {
×
34
                        continue
×
35
                }
36
                err := resizer.ResizeFilesystem(deviceName, func(cmd string) (out string, err error) {
×
37
                        return c.ExecCommand(podName, "bash", "-c", cmd)
×
38
                })
×
39

40
                return err
×
41
        }
42
        return fmt.Errorf("could not resize filesystem: no compatible resizers for the filesystem of type %q", fsType)
×
43
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc