# Test environment on package server

**URL:** <https://racket.discourse.group/t/test-environment-on-package-server/512>\
**Category:** Questions & Answers\
**Tags:** question, package-server, raco\
**Created:** [January 2, 2022, 4:47pm UTC](https://racket.discourse.group/t/test-environment-on-package-server/512 "2022-01-02T16:47:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sschwarzer](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/sschwarzer/32/1940_2.png) [@sschwarzer](https://racket.discourse.group/u/sschwarzer)\
**Post date:** [January 2, 2022, 4:47pm UTC](https://racket.discourse.group/t/test-environment-on-package-server/512/1 "2022-01-02T16:47:47Z")

</div>

For one of my packages, there are [failing tests](https://pkg-build.racket-lang.org/server/built/test-fail/raco-exe-multitarget.txt) in the package server environment, although the tests succeed on my machine.

From the package server's error log it looks like `(find-executable-path "raco")` doesn't find `raco` in the `PATH` environment variable.

A few questions:

- Can someone confirm that `raco` isn't in the `PATH`? (If not, it would be great to add it.)
- Is there any documentation about the package server test environment, _for example_, which OS is used, which OS packages are installed and what's available in `PATH`?
- What about displaying some important environment variables as part of the test log?
- What kind of internet connection is available in the test environment? (I ask because my integration tests clone a Git repository that I run tests on.)

There seems to be _some_ information about the environment in the log,

```scheme
(/usr/bin/env DISPLAY=:1 PLT_PKG_BUILD_SERVICE=1 PLTUSERHOME=/home/root//user PLT_PKG_BUILD_SERVICE=1 CI=true PLTSTDERR=debug@pkg error PLT_INFO_ALLOW_VARS=;PLT_PKG_BUILD_SERVICE PLTCOMPILEDROOTS=/home/root//zo: /usr/bin/xvfb-run -n 1 /bin/sh -c cd "/home/root/"/racket && bin/racket -MCR "/home/root/"/zo: -l- raco pkg install -u --auto raco-exe-multitarget && bin/racket -MCR "/home/root/"/zo: -l- raco test --drdr --package raco-exe-multitarget)

```

This looks like the shell command that's used to run the tests, which includes setting _some_ environment variables on the fly, in addition to the already-set ones.

The part

```scheme
cd "/home/root/"/racket && bin/racket

```

looks like the Racket binaries are in `/home/root/racket/bin`. I guess I can add this to the `PATH` in my internal `test` module, but before I add this workaround, I'd like to suggest that this is added to `PATH` anyway. Also, many of the tests will fail without internet connection (see above).

---

<div class="post-metadata">

**Author:** ![SamPhillips](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samphillips/32/15_2.png) [@SamPhillips](https://racket.discourse.group/u/SamPhillips)\
**Post date:** [January 2, 2022, 8:07pm UTC](https://racket.discourse.group/t/test-environment-on-package-server/512/2 "2022-01-02T20:07:11Z")

</div>

> [@sschwarzer](#):
>
> Is there any documentation about the package server test environment, _for example_ , which OS is used, which OS packages are installed and what's available in `PATH` ?

This doesn't have information on `PATH`, but it is the documentation for the build environment: [Racket: About Package Builds](https://pkg-build.racket-lang.org/about.html)

---

<div class="post-metadata">

**Author:** ![sschwarzer](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/sschwarzer/32/1940_2.png) [@sschwarzer](https://racket.discourse.group/u/sschwarzer)\
**Post date:** [January 2, 2022, 9:48pm UTC](https://racket.discourse.group/t/test-environment-on-package-server/512/3 "2022-01-02T21:48:42Z")

</div>

> [@SamPhillips](#):
>
> This doesn't have information on `PATH` , but it is the documentation for the build environment: [Racket: About Package Builds](https://pkg-build.racket-lang.org/about.html)

Thank you, this document is quite helpful. 🙂 For my particular use case, these sentences are especially relevant:

> Packages are built on a 64-bit Linux virtual machine (VM) that is isolated from the network.

> There’s no way for a package to opt out of testing, but a package author can implement a test suite that skip tests under adverse conditions. In case there’s no other way for a test suite to determine that it can’t run, the package-build service sets the PLT\_PKG\_BUILD\_SERVICE and CI environment variables when running tests; a test suite can explicitly check for the environment variable and skip tests that can’t work.

My plan is now to check `PLT_PKG_BUILD_SERVICE`. If it's set, I modify the `PATH` variable for the tests that only need to run a local `raco cross` and skip the tests that require network access. Further down the road, I may try to get the "test data" from an installed package instead of cloning it from the network.

---

<div class="post-metadata">

**Author:** ![samth](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/32/3_2.png) [@samth](https://racket.discourse.group/u/samth)\
**Post date:** [January 3, 2022, 2:18pm UTC](https://racket.discourse.group/t/test-environment-on-package-server/512/4 "2022-01-03T14:18:54Z")

</div>

To find `raco` I think you can do this using `(find-system-path 'exec-file)` and path manipulation, or you can just run the equivalent of `racket -l raco -- cross`.

---

<div class="post-metadata">

**Author:** ![sschwarzer](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/sschwarzer/32/1940_2.png) [@sschwarzer](https://racket.discourse.group/u/sschwarzer)\
**Post date:** [January 4, 2022, 12:58pm UTC](https://racket.discourse.group/t/test-environment-on-package-server/512/5 "2022-01-04T12:58:31Z")

</div>

In the end, I deactivated the test suite that uses `raco cross`. The "problem" is that I use `raco cross --browse`, and this also needs network access. 🙃 So for now, I run most of the tests only on my development machine.

Eventually, I'll probably set up automated tests at [Sourcehut](https://sourcehut.org/), [as I did for another project](https://git.sr.ht/~sschwarzer/sudoku-solver/tree/main/item/.build.yml).
