Comments (7)
Hey. Any update on this?
from cockroach-go.
I agree that the -cockroach-binary
is pretty useless. I also think that the default binary used by the test server is useless - it defaults to a nightly build, right?
Passing the version to the test server constructor sounds right to me. I'd use the option pattern to do it. Additionally, I think an env var that overrides specified binary version option would also be a good idea.
Generally, I do wonder about the future of the testserver library, though. An alternative to the current model of spinning up a separate cockroach server process is to run cockroach in the test's (Go) process. That's how most of the test for crdb itself run - they start servers in-process, and those server use in-memory stores (an external process could also use the in-memory store if we configured it accordingly). A problem with this is that the client test would have to vendor the whole cockroach codebase, and more importantly it'd need to be able to build crdb. The build process currently is pretty involved with a bunch of dependencies, but I think we could simplify it for these test purposes. I am curious to get your opinion on in-process vs out-of-process crdb.
from cockroach-go.
I meant passing local path to the binary, as its done via the -cockroach-binary
flag right now. But just version also works.
Here is the download link: https://edge-binaries.cockroachdb.com/cockroach/cockroach.darwin-amd64.LATEST
I can't tell is it a nightly build or not, actually.
it defaults to a nightly build, right?
As an application developer I want a simple interface to start a test crdb server. testserver
package does it pretty well (but it lacks some customisation options). If it possible to start a crdb server in test's Go process as simple as:
testserver.StartTestServer("19.6" /* version */)
With all building and other stuff hidden inside, it could be a replacement to the current implementation.
But I guest it will be hard to build a specific cockroachdb version in vendor codebase.
And even if do possible to achieve that, I don't actually see any benefits compared to the current out-of-process crdb, if we enrich testserver
package with customization (see also #69)
from cockroach-go.
Any updates?
from cockroach-go.
I would be open to a PR that changes testserver
to use an environment variable for the file path if it's specified. That seems like the most lightweight change.
The idea of passing in a version number into NewTestServer
is also pretty appealing. It will be a slightly harder lift since you'll have to refactor testserver/binaries.go
to make it aware of different version number URLs. But if you keep the interface backwards compatible (I agree the options pattern sounds good), then feel free to give this a shot too.
FYI: all the published versions have predictable URLs that will never change. You can see them all here: https://www.cockroachlabs.com/docs/releases/
from cockroach-go.
I would go with an environment variable for the binary path because this will allow running tests offline after you have the cockroach binary installed locally.
from cockroach-go.
For what it's worth, I was able to figure out how to use the -cockroach-binary
flag for tests. The command is like this:
go test -p 1 -race -v ./... -args -cockroach-binary=/path/to/cockroach
from cockroach-go.
Related Issues (20)
- testserver: if killed during download, future invocations will not work
- testserver: Start() is useless HOT 2
- testserver: Make it easier to use store=type=mem
- Unit tests with sqlproxy fail against bleeding edge CockroachDB version HOT 3
- testserver: cmd with `--log` option does not generate `listen-url` in tests
- Feature Request: Support `BEGIN PRIORITY X` for pgx HOT 3
- ExecuteInTx does not honor context cancellation HOT 3
- Need variants of ExecuteInTx and ExecuteTx that take a `fn(context.Context, ...)` as arg
- Custom binary - tests failure HOT 1
- standard package errors should be used instead of archived pkg/errors
- Add support for jackc/pgx/v5 HOT 1
- Error parsing headers when downloading binary
- Testing in pipeline
- Print log when cannot poll from ListeningURLFile
- Vendor GetTotalMemoryWithoutLogging from github.com/cockroachdb/cockroach HOT 4
- User requested rollbacks
- package version logic points to unavailable cockroachdb version HOT 2
- cockroach-go testserver: Failed to fetch latest binary: error downloading https://binaries.cockroachdb.com/cockroach-v23.2.0.darwin-10.9-amd64.tgz: 404 (404 Not Found) HOT 2
- Should be 25P02 retriable? HOT 8
- Second call to Start() throws error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cockroach-go.