Skip to content

Commit

Permalink
Merge pull request #1123 from k1LoW/remove-runn-
Browse files Browse the repository at this point in the history
Do not include `runn.*` in the include runner store.
  • Loading branch information
k1LoW authored Dec 20, 2024
2 parents 8fc27a4 + 12d07e9 commit 043ffa9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 28 deletions.
22 changes: 1 addition & 21 deletions store.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func (s *store) toMap() map[string]any {
}

// toMapForIncludeRunner - returns a map for include runner.
// toMap without s.parentVars and s.needsVars.
// toMap without s.parentVars s.needsVars and runn.* .
func (s *store) toMapForIncludeRunner() map[string]any {
store := map[string]any{}
store[storeRootKeyEnv] = envMap()
Expand All @@ -318,26 +318,6 @@ func (s *store) toMapForIncludeRunner() map[string]any {
if s.cookies != nil {
store[storeRootKeyCookie] = s.cookies
}

runnm := map[string]any{}
// runn.kv
if s.kv != nil {
s.kv.mu.Lock()
kv := map[string]any{}
for k, v := range s.kv.m {
kv[k] = v
}
runnm[storeRunnKeyKV] = kv
s.kv.mu.Unlock()
}
// runn.i
runnm[storeRunnKeyRunNIndex] = s.runNIndex
// runn.stdin
if stdin != nil {
runnm[storeRunnKeyStdin] = stdin
}
store[storeRootKeyRunn] = runnm

s.setMaskKeywords(store)

return store
Expand Down
14 changes: 7 additions & 7 deletions store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func TestToMapForIncludeRunner(t *testing.T) {
store{
stepList: map[int]map[string]any{},
},
[]string{"env", "vars", "steps", "runn"},
[]string{"env", "vars", "steps"},
},
{
store{
Expand All @@ -281,41 +281,41 @@ func TestToMapForIncludeRunner(t *testing.T) {
"key": "value",
},
},
[]string{"env", "vars", "steps", "runn"},
[]string{"env", "vars", "steps"},
},
{
store{
useMap: true,
},
[]string{"env", "vars", "steps", "runn"},
[]string{"env", "vars", "steps"},
},
{
store{
parentVars: map[string]any{
"key": "value",
},
},
[]string{"env", "vars", "steps", "runn"},
[]string{"env", "vars", "steps"},
},
{
store{
bindVars: map[string]any{
"bind": "value",
},
},
[]string{"env", "vars", "steps", "bind", "runn"},
[]string{"env", "vars", "steps", "bind"},
},
{
store{
loopIndex: &li,
},
[]string{"env", "vars", "steps", "i", "runn"},
[]string{"env", "vars", "steps", "i"},
},
{
store{
cookies: map[string]map[string]*http.Cookie{},
},
[]string{"env", "vars", "steps", "cookies", "runn"},
[]string{"env", "vars", "steps", "cookies"},
},
}
trns := cmp.Transformer("Sort", func(in []string) []string {
Expand Down

0 comments on commit 043ffa9

Please sign in to comment.