:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
package core
import "testing"
func TestFindLegacyObjectStorageVolume(t *testing.T) {
tests := []struct {
name string
volumes []string
want string
}{
{
// The SeaweedFS replacement mounts objectstorage-data. Matching it would make
// the installer warn forever and point a salvage run at the live volume.
name: "ignores the seaweedfs volume",
volumes: []string{"posthog_objectstorage-data", "posthog_postgres-data"},
want: "",
},
{
name: "finds the compose-prefixed minio volume",
volumes: []string{"posthog_objectstorage-data", "posthog_objectstorage"},
want: "posthog_objectstorage",
},
{
name: "finds an unprefixed minio volume",
volumes: []string{"objectstorage"},
want: "objectstorage",
},
{
name: "tolerates the blank line docker volume ls leaves",
volumes: []string{"posthog_objectstorage", ""},
want: "posthog_objectstorage",
},
{
name: "reports nothing on a new install",
volumes: []string{},
want: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := findLegacyObjectStorageVolume(tt.volumes); got != tt.want {
t.Errorf("findLegacyObjectStorageVolume(%v) = %q, want %q", tt.volumes, got, tt.want)
}
})
}
}