-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
tests.sh
executable file
·137 lines (126 loc) · 4.3 KB
/
tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/usr/bin/env bash
#
# Copyright (c) 2022, sycured
# All rights reserved
#
# SPDX-License-Identifier: GPL-2.0-only
#
set -e
export JIRA_CLI="./target/debug/jira_cli"
export JIRA_PROJECT_NAME="ci-$GIT_ACTION_RUN_NUMBER"
export JIRA_PROJECT_KEY="CI$GIT_ACTION_RUN_NUMBER"
export JIRA_VERSION_NAME="v0.0.0"
# version
$JIRA_CLI -V
# help
$JIRA_CLI help
# check_version
$JIRA_CLI check_version
# generate
$JIRA_CLI generate bash >/tmp/jira_cli.bash
$JIRA_CLI generate elvish >/tmp/jira_cli.elvish
$JIRA_CLI generate fish >/tmp/jira_cli.fish
$JIRA_CLI generate powershell >/tmp/jira_cli.ps1
$JIRA_CLI generate zsh >/tmp/jira_cli.zsh
# user
## get_id
JIRA_USER_ACCOUNT_ID=$($JIRA_CLI user get_account_id "$JIRA_USER")
export JIRA_USER_ACCOUNT_ID
echo "$JIRA_USER_ACCOUNT_ID"
# project
## create
echo "project create"
$JIRA_CLI project create $JIRA_PROJECT_NAME $JIRA_PROJECT_KEY "$JIRA_USER_ACCOUNT_ID"
## add_component
$JIRA_CLI project add_component "test_component" $JIRA_PROJECT_KEY "$JIRA_USER_ACCOUNT_ID"
## list_components
$JIRA_CLI project list_components $JIRA_PROJECT_KEY
## get_id
echo "project get_id"
$JIRA_CLI project get_id $JIRA_PROJECT_KEY
JIRA_PROJECT_ID=$($JIRA_CLI project get_id $JIRA_PROJECT_KEY)
export JIRA_PROJECT_ID
## list_link_types
echo "list_link_types"
$JIRA_CLI issue list_link_types
## create_link_type
echo "create_link_type"
JIRA_LINK_TYPE_ID=$($JIRA_CLI i clt test test test | awk '{print $6}')
export JIRA_LINK_TYPE_ID
## update_link_type
echo "update_link_type"
$JIRA_CLI i ult "$JIRA_LINK_TYPE_ID" test "is tested by" "tests"
## get_link_type
echo "get_link_type"
$JIRA_CLI i glt "$JIRA_LINK_TYPE_ID"
## delete_link_type
echo "delete_link_type"
$JIRA_CLI i dlt "$JIRA_LINK_TYPE_ID"
## list_features
echo "project list_features"
$JIRA_CLI project list_features $JIRA_PROJECT_KEY
## set_feature_state
echo "project set_feature_state"
$JIRA_CLI project set_feature_state $JIRA_PROJECT_KEY jsw.agility.releases ENABLED
## new_version
echo "project new_version"
$JIRA_CLI project new_version
$JIRA_CLI project new_version test
## list_versions
echo "project list_versions"
$JIRA_CLI project list_versions
# issue
## list_types
echo "issue list_types"
$JIRA_CLI issue list_types $JIRA_PROJECT_KEY
## create
echo "issue create"
$JIRA_CLI issue create Task "little test" "little test using jira_cli" "$JIRA_USER_ACCOUNT_ID" $JIRA_PROJECT_KEY
$JIRA_CLI issue create Task "little test2" "little test using jira_cli" "$JIRA_USER_ACCOUNT_ID" $JIRA_PROJECT_KEY
$JIRA_CLI issue create Task "little test3" "little test using jira_cli" "$JIRA_USER_ACCOUNT_ID" $JIRA_PROJECT_KEY
$JIRA_CLI issue create Task "little test4" "little test using jira_cli" "$JIRA_USER_ACCOUNT_ID" $JIRA_PROJECT_KEY
$JIRA_CLI issue create Task "little test5" "little test using jira_cli" "$JIRA_USER_ACCOUNT_ID" $JIRA_PROJECT_KEY
## add_version
echo "issue add_version"
$JIRA_CLI issue add_version "$JIRA_PROJECT_KEY"-1 $JIRA_VERSION_NAME
$JIRA_CLI issue add_version "$JIRA_PROJECT_KEY"-1 test
JIRA_VERSION_NAME=test $JIRA_CLI issue add_version "$JIRA_PROJECT_KEY"-2,"$JIRA_PROJECT_KEY"-3
$JIRA_CLI i av "$JIRA_PROJECT_KEY"-4,"$JIRA_PROJECT_KEY"-5
## add_vote
echo "issue add_vote"
$JIRA_CLI issue add_vote "$JIRA_PROJECT_KEY"-1
$JIRA_CLI issue add_vote "$JIRA_PROJECT_KEY"-3
## add_label
echo "issue add_label"
$JIRA_CLI issue add_label "$JIRA_PROJECT_KEY"-1 "CI"
$JIRA_CLI issue add_label "$JIRA_PROJECT_KEY"-1 "CI2"
$JIRA_CLI issue al "$JIRA_PROJECT_KEY"-2,"$JIRA_PROJECT_KEY"-3 "CI3"
$JIRA_CLI issue al "$JIRA_PROJECT_KEY"-4,"$JIRA_PROJECT_KEY"-5 "CI4"
## remove_version
echo "issue remove_version"
$JIRA_CLI issue remove_version "$JIRA_PROJECT_KEY"-1 test
## remove_vote
echo "issue remove_vote"
$JIRA_CLI issue remove_vote "$JIRA_PROJECT_KEY"-1
## list_votes
echo "issue list_votes"
$JIRA_CLI issue list_votes "$JIRA_PROJECT_KEY"-3
## remove_label
echo "issue remove_label"
$JIRA_CLI issue remove_label "$JIRA_PROJECT_KEY"-1 "CI2"
$JIRA_CLI i rl "$JIRA_PROJECT_KEY"-2,"$JIRA_PROJECT_KEY"-3 "CI3"
## show_fixversions
echo "issue show_fixversions"
$JIRA_CLI issue show_fixversions "$JIRA_PROJECT_KEY"-1
## delete an issue
echo "issue delete"
$JIRA_CLI issue delete "$JIRA_PROJECT_KEY"-5
## get transitions
echo "get transitions"
$JIRA_CLI issue get_transitions "$JIRA_PROJECT_KEY"-1
# labels
echo "labels"
$JIRA_CLI labels
# project - delete_project
echo "delete_project"
./test_project_destroy.exp