Skip to content

Commit

Permalink
fix(orca-redis): delete stageIndex when deleting a pipeline (spinnake…
Browse files Browse the repository at this point in the history
  • Loading branch information
skandragon authored Feb 28, 2019
1 parent db21076 commit 83c5e16
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,7 @@ private void deleteInternal(RedisClientDelegate delegate, ExecutionType type, St
// do nothing
} finally {
c.del(key);
c.del(key + ":stageIndex");
c.srem(alljobsKey(type), id);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,34 @@ class JedisExecutionRepositorySpec extends ExecutionRepositoryTck<RedisExecution
jedis.zrange(RedisExecutionRepository.executionsByPipelineKey(pipeline.pipelineConfigId), 0, 1).isEmpty()
}

def "deleting pipelines remove the :stageIndex key"() {
given:
def pipeline = pipeline {
stage {
type = "one"
}
application = "someApp"
}

when:
repository.store(pipeline)

then:
jedis.type("pipeline:${pipeline.id}") == "hash"
jedis.type("pipeline:${pipeline.id}:stageIndex") == "list"

when:
repository.delete(pipeline.type, pipeline.id)
repository.retrieve(pipeline.type, pipeline.id)

then:
thrown ExecutionNotFoundException

and:
jedis.type("pipeline:${pipeline.id}") == "none"
jedis.type("pipeline:${pipeline.id}:stageIndex") == "none"
}

@Unroll
def "retrieving orchestrations limits the number of returned results"() {
given:
Expand Down

0 comments on commit 83c5e16

Please sign in to comment.