tryvium-travels/memongo

gzip: invalid header

Closed this issue · 2 comments

func startTestDbServer() string {
	// Start a MongoDB server and get a connection string for it
	opts := &memongo.Options{
		MongoVersion: "6.0.1",
	}
	if runtime.GOARCH == "arm64" {
		if runtime.GOOS == "darwin" {
			// Only set the custom url as workaround for arm64 macs
			opts.DownloadURL = "https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-6.0.1.tgz"
		}
	}

	mongoServer, err := memongo.StartWithOptions(opts)
	if err != nil {
		log.Fatal(err)
	}

	// Connect to the in-memory server with a MongoDB client
	return mongoServer.URI()
}

Test Logs:

[memongo] [INFO]  Starting MongoDB with options &memongo.Options{ShouldUseReplica:false, Port:33755, CachePath:"/home/asimzahid/.cache/memongo", MongoVersion:"6.0.1", DownloadURL:"https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-6.0.1.tgz", MongodBin:"", Logger:(*log.Logger)(nil), LogLevel:0, StartupTimeout:10000000000, Auth:false}
[memongo] [INFO]  mongod from https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-6.0.1.tgz does not exist in cache, downloading to /home/asimzahid/.cache/memongo/mongodb-linux-x86_64-ubuntu2204-6_0_1_tgz_68b6ad5aea/mongod
2023/10/05 13:43:48 error intializing gzip reader from /tmp/110027803: gzip: invalid header, https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-6.0.1.tgz

Unable to resolve this issue.
Could anyone please help with understand this and resolve it?

Hello @MrAsimZahid

Have you tried to check if the version 6.0.1 exists for arm 64? Maybe the URL is invalid. Check if you can download it normally with the browser, for example

Closed as stalling