Skip to content

Commit 07042c4

Browse files
committed
revert cache test deletion
1 parent dae54d4 commit 07042c4

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package cache
2+
3+
import (
4+
"encoding/json"
5+
"testing"
6+
7+
"github.com/stretchr/testify/require"
8+
9+
"github.com/sourcegraph/sourcegraph/lib/batches"
10+
"github.com/sourcegraph/sourcegraph/lib/batches/env"
11+
)
12+
13+
func TestKeyer_Key_PerRunEnvVarsIgnored(t *testing.T) {
14+
var stepEnv env.Environment
15+
require.NoError(t, json.Unmarshal(
16+
[]byte(`["SRC_EXECUTOR_JOB_TOKEN", "SRC_EXECUTOR_JOB_ID", "SRC_EXECUTOR_NAME"]`),
17+
&stepEnv,
18+
))
19+
step := batches.Step{Run: "foo", Env: stepEnv}
20+
repo := batches.Repository{ID: "r", Name: "r"}
21+
22+
unset, err := (&CacheKey{Repository: repo, Steps: []batches.Step{step}, StepIndex: 0}).Key()
23+
require.NoError(t, err)
24+
resolved, err := (&CacheKey{Repository: repo, Steps: []batches.Step{step}, StepIndex: 0, GlobalEnv: []string{
25+
"SRC_EXECUTOR_JOB_TOKEN=tok",
26+
"SRC_EXECUTOR_JOB_ID=42",
27+
"SRC_EXECUTOR_NAME=executor-abc",
28+
}}).Key()
29+
require.NoError(t, err)
30+
require.Equal(t, unset, resolved)
31+
}

0 commit comments

Comments
 (0)