diff --git a/delivery/http_server/end2end/setup/docker.go b/delivery/http_server/end2end/setup/docker.go index 9110ae0..2eddecb 100644 --- a/delivery/http_server/end2end/setup/docker.go +++ b/delivery/http_server/end2end/setup/docker.go @@ -101,7 +101,7 @@ func (t *TestContainer) Start() { // pulls mariaDB image, creates a container based on it and runs it t.mariaResource, err = t.dockerPool.RunWithOptions( &dockertest.RunOptions{ - Repository: "mariadb", + Repository: "bitnami/mariadb", Tag: "11.1", Env: []string{"MARIADB_ROOT_PASSWORD=secret"}, }, func(config *docker.HostConfig) { @@ -122,7 +122,7 @@ func (t *TestContainer) Start() { t.redisResource, err = t.dockerPool.RunWithOptions( &dockertest.RunOptions{ - Repository: "redis", + Repository: "bitnami/redis", Tag: "6.2", Env: []string{"ALLOW_EMPTY_PASSWORD=yes"}, }, func(config *docker.HostConfig) { diff --git a/delivery/http_server/end2end/setup/seed_data/10_create-rejected-kindboxreq-for-benefactor1.sql b/delivery/http_server/end2end/setup/seed_data/10_create-rejected-kindboxreq-for-benefactor1.sql deleted file mode 100644 index 1fcb401..0000000 --- a/delivery/http_server/end2end/setup/seed_data/10_create-rejected-kindboxreq-for-benefactor1.sql +++ /dev/null @@ -1,16 +0,0 @@ --- +migrate Up -INSERT INTO `kind_box_reqs` (`id`, `benefactor_id`, `kind_box_type`, `count_requested`, `description`, `status`, `deliver_refer_time_id`, `deliver_refer_date`, `deliver_address_id`) -VALUES ( - 3, - 1, - 'on-table', - 100, - 'too many!', - 'rejected', - 1, - NOW() + INTERVAL 7 DAY, - 1 -); - --- +migrate Down -DELETE FROM `kind_box_reqs` WHERE id = 3; \ No newline at end of file diff --git a/delivery/http_server/end2end/setup/seed_data/11_create-assigned-sender-agent-kindboxreq-for-benefactor1.sql b/delivery/http_server/end2end/setup/seed_data/11_create-assigned-sender-agent-kindboxreq-for-benefactor1.sql deleted file mode 100644 index 6602eb5..0000000 --- a/delivery/http_server/end2end/setup/seed_data/11_create-assigned-sender-agent-kindboxreq-for-benefactor1.sql +++ /dev/null @@ -1,17 +0,0 @@ --- +migrate Up -INSERT INTO `kind_box_reqs` (`id`, `benefactor_id`, `kind_box_type`, `count_requested`, `count_accepted`, `status`, `deliver_refer_time_id`, `deliver_refer_date`, `deliver_address_id`, `sender_agent_id`) -VALUES ( - 4, - 1, - 'on-table', - 1, - 1, - 'assigned-sender-agent', - 1, - NOW() + INTERVAL 7 DAY, - 1, - 1 - ); - --- +migrate Down -DELETE FROM `kind_box_reqs` WHERE id = 4; \ No newline at end of file diff --git a/delivery/http_server/end2end/setup/seed_data/12_create-delivered-kindboxreq-for-benefactor1.sql b/delivery/http_server/end2end/setup/seed_data/12_create-delivered-kindboxreq-for-benefactor1.sql deleted file mode 100644 index 9a828ab..0000000 --- a/delivery/http_server/end2end/setup/seed_data/12_create-delivered-kindboxreq-for-benefactor1.sql +++ /dev/null @@ -1,18 +0,0 @@ --- +migrate Up -INSERT INTO `kind_box_reqs` (`id`, `benefactor_id`, `kind_box_type`, `count_requested`, `count_accepted`, `status`, `deliver_refer_time_id`, `deliver_refer_date`, `deliver_address_id`, `sender_agent_id`, `delivered_at`) -VALUES ( - 5, - 1, - 'on-table', - 1, - 1, - 'delivered', - 1, - NOW() - INTERVAL 7 DAY, - 1, - 1, - NOW() - ); - --- +migrate Down -DELETE FROM `kind_box_reqs` WHERE id = 5; \ No newline at end of file diff --git a/delivery/http_server/end2end/setup/seed_data/1_create-admin-superadmin.sql b/delivery/http_server/end2end/setup/seed_data/1_create-admin-superadmin.sql deleted file mode 100644 index f35e6fb..0000000 --- a/delivery/http_server/end2end/setup/seed_data/1_create-admin-superadmin.sql +++ /dev/null @@ -1,18 +0,0 @@ --- +migrate Up -INSERT INTO `admins` (`id`, `first_name`, `last_name`, `password`, `phone_number`, `role`, `description`, `email`, `gender`, `status`) -VALUES ( - 2, - 'ruhi', - 'hosseini', - -- password is: Abc123456 - '$2a$10$UggC7sgECCaNm2TAkchve.TLcHJuxPAVZkzMfCDZqKRQVHcJZaoX2', - '09384664401', - 'super-admin', - 'testing', - 'admin.superadmin.01@gmail.com', - 'male', - 'active' - ); - --- +migrate Dow -DELETE FROM `admins` WHERE id = 2; \ No newline at end of file diff --git a/delivery/http_server/end2end/setup/seed_data/1_create-admins.sql b/delivery/http_server/end2end/setup/seed_data/1_create-admins.sql new file mode 100644 index 0000000..ec0cefc --- /dev/null +++ b/delivery/http_server/end2end/setup/seed_data/1_create-admins.sql @@ -0,0 +1,48 @@ +-- +migrate Up +INSERT INTO `admins` (`id`, `first_name`, `last_name`, `password`, `phone_number`, `role`, `description`, `email`, `gender`, `status`) +VALUES + -- super admin + ( + 2, + 'ruhi', + 'hosseini', + -- password is: Abc123456 + '$2a$10$UggC7sgECCaNm2TAkchve.TLcHJuxPAVZkzMfCDZqKRQVHcJZaoX2', + '09384664401', + 'super-admin', + 'testing', + 'admin.superadmin.01@gmail.com', + 'male', + 'active' + ), + -- admin + ( + 3, + 'ruhi', + 'hosseini', + -- password is: Abc123456 + '$2a$10$xaNwJqcuRUlPhAUPZhhV3.WRmI5iBea5RzvL4qWS6OCFk0F7bKvaW', + '09384664402', + 'admin', + 'testing', + 'admin.admin.01@gmail.com', + 'male', + 'active' + ), + -- agent + ( + 4, + 'ruhi', + 'hosseini', + -- password is: Abc123456 + '$2a$10$A4qiAep9OGYe2aFT3Tn1cuJfj99Xp6WA2F0SN9I7zAS01JGFU7XAO', + '09384664403', + 'agent', + 'testing', + 'admin.agent.01@gmail.com', + 'male', + 'active' + ); + +-- +migrate Down +DELETE FROM `admins` WHERE id != 1; \ No newline at end of file diff --git a/delivery/http_server/end2end/setup/seed_data/2_create-admin-admin.sql b/delivery/http_server/end2end/setup/seed_data/2_create-admin-admin.sql deleted file mode 100644 index c6e7ad6..0000000 --- a/delivery/http_server/end2end/setup/seed_data/2_create-admin-admin.sql +++ /dev/null @@ -1,18 +0,0 @@ --- +migrate Up -INSERT INTO `admins` (`id`, `first_name`, `last_name`, `password`, `phone_number`, `role`, `description`, `email`, `gender`, `status`) -VALUES ( - 3, - 'ruhi', - 'hosseini', - -- password is: Abc123456 - '$2a$10$xaNwJqcuRUlPhAUPZhhV3.WRmI5iBea5RzvL4qWS6OCFk0F7bKvaW', - '09384664402', - 'admin', - 'testing', - 'admin.admin.01@gmail.com', - 'male', - 'active' -); - --- +migrate Down -DELETE FROM `admins` WHERE id = 3; \ No newline at end of file diff --git a/delivery/http_server/end2end/setup/seed_data/2_create-benefactors.sql b/delivery/http_server/end2end/setup/seed_data/2_create-benefactors.sql new file mode 100644 index 0000000..3486f16 --- /dev/null +++ b/delivery/http_server/end2end/setup/seed_data/2_create-benefactors.sql @@ -0,0 +1,28 @@ +-- +migrate Up +INSERT INTO `benefactors` (`id`, `first_name`, `last_name`, `phone_number`, `description`, `email`, `gender`, `birth_date`) +VALUES + -- benefactor 1 + ( + 1, + 'ruhi', + 'hosseini', + '09384664404', + 'testing', + 'benefactor.01@gmail.com', + 'male', + '1998-05-02 04:20:00' + ), + -- benefactor 2 + ( + 2, + 'doctor', + 'who', + '09384664405', + 'testing', + 'benefactor.02@gmail.com', + 'male', + '2000-05-02 04:20:00' + ); + +-- +migrate Down +DELETE FROM `benefactors`; \ No newline at end of file diff --git a/delivery/http_server/end2end/setup/seed_data/3_create-address-for-benefactors.sql b/delivery/http_server/end2end/setup/seed_data/3_create-address-for-benefactors.sql new file mode 100644 index 0000000..5ea4217 --- /dev/null +++ b/delivery/http_server/end2end/setup/seed_data/3_create-address-for-benefactors.sql @@ -0,0 +1,10 @@ +-- +migrate Up +INSERT INTO `addresses` (`id`, `postal_code`, `address`, `lat`, `lon`, `name`, `city_id`, `province_id`, `benefactor_id`) +VALUES + -- address 1 + (1, '3719655861', 'tehran sare koche 1', 35.632508, 51.452859, 'home1', 8, 8, 1), + -- address 2 + (2, '3719655869', 'tehran sare koche 2', 35.735638, 51.312945, 'home2', 8, 8, 2); + +-- +migrate Down +DELETE FROM `addresses`; \ No newline at end of file diff --git a/delivery/http_server/end2end/setup/seed_data/3_create-admin-agent.sql b/delivery/http_server/end2end/setup/seed_data/3_create-admin-agent.sql deleted file mode 100644 index b4880cf..0000000 --- a/delivery/http_server/end2end/setup/seed_data/3_create-admin-agent.sql +++ /dev/null @@ -1,18 +0,0 @@ --- +migrate Up -INSERT INTO `admins` (`id`, `first_name`, `last_name`, `password`, `phone_number`, `role`, `description`, `email`, `gender`, `status`) -VALUES ( - 4, - 'ruhi', - 'hosseini', - -- password is: Abc123456 - '$2a$10$A4qiAep9OGYe2aFT3Tn1cuJfj99Xp6WA2F0SN9I7zAS01JGFU7XAO', - '09384664403', - 'agent', - 'testing', - 'admin.agent.01@gmail.com', - 'male', - 'active' - ); - --- +migrate Down -DELETE FROM `admins` WHERE id = 4; \ No newline at end of file diff --git a/delivery/http_server/end2end/setup/seed_data/4_create-benefactor1.sql b/delivery/http_server/end2end/setup/seed_data/4_create-benefactor1.sql deleted file mode 100644 index 24f311a..0000000 --- a/delivery/http_server/end2end/setup/seed_data/4_create-benefactor1.sql +++ /dev/null @@ -1,15 +0,0 @@ --- +migrate Up -INSERT INTO `benefactors` (`id`, `first_name`, `last_name`, `phone_number`, `description`, `email`, `gender`, `birth_date`) -VALUES ( - 1, - 'ruhi', - 'hosseini', - '09384664404', - 'testing', - 'benefactor.01@gmail.com', - 'male', - '1998-05-02 04:20:00' - ); - --- +migrate Down -DELETE FROM `benefactors` WHERE id = 1; \ No newline at end of file diff --git a/delivery/http_server/end2end/setup/seed_data/4_create-kindboxreqs-for-benefactors.sql b/delivery/http_server/end2end/setup/seed_data/4_create-kindboxreqs-for-benefactors.sql new file mode 100644 index 0000000..92cedde --- /dev/null +++ b/delivery/http_server/end2end/setup/seed_data/4_create-kindboxreqs-for-benefactors.sql @@ -0,0 +1,17 @@ +-- +migrate Up +INSERT INTO `kind_box_reqs` (`id`, `benefactor_id`, `kind_box_type`, `count_requested`, `count_accepted`, `description`, `status`, `deliver_refer_time_id`, `deliver_refer_date`, `deliver_address_id`, `sender_agent_id`, `delivered_at`) +VALUES + -- pending kindboxreq for benefactor 1 + (1, 1, 'on-table', 1, NULL, NULL, 'pending', 1, NOW() + INTERVAL 7 DAY, 1, NULL, NULL), + -- accepted kindboxreq for benefactor 1 + (2, 1, 'on-table', 2, 1, NULL, 'accepted', 1, NOW() + INTERVAL 7 DAY, 1, NULL, NULL), + -- rejected kindboxreq for benefactor 1 + (3, 1, 'on-table', 100, NULL, 'too many!', 'rejected', 1, NOW() + INTERVAL 7 DAY, 1, NULL, NULL), + -- assigned sender agent kindboxreq for benefactor 1 + (4, 1, 'on-table', 1, 1, NULL, 'assigned-sender-agent', 1, NOW() + INTERVAL 7 DAY, 1, 1, NULL), + -- delivered kindboxreq for benefactor 1 + (5, 1, 'on-table', 1, 1, NULL, 'delivered', 1, NOW() - INTERVAL 7 DAY, 1, 1, NOW()); + + +-- +migrate Down +DELETE FROM `kind_box_reqs`; \ No newline at end of file diff --git a/delivery/http_server/end2end/setup/seed_data/5_create-benefactor2.sql b/delivery/http_server/end2end/setup/seed_data/5_create-benefactor2.sql deleted file mode 100644 index 375e91f..0000000 --- a/delivery/http_server/end2end/setup/seed_data/5_create-benefactor2.sql +++ /dev/null @@ -1,15 +0,0 @@ --- +migrate Up -INSERT INTO `benefactors` (`id`, `first_name`, `last_name`, `phone_number`, `description`, `email`, `gender`, `birth_date`) -VALUES ( - 2, - 'doctor', - 'who', - '09384664405', - 'testing', - 'benefactor.02@gmail.com', - 'male', - '2000-05-02 04:20:00' - ); - --- +migrate Down -DELETE FROM `benefactors` WHERE id = 2; \ No newline at end of file diff --git a/delivery/http_server/end2end/setup/seed_data/13_create-delivered-kindbox-for-benefactor1.sql b/delivery/http_server/end2end/setup/seed_data/5_create-kindboxes-for-benefactor1.sql similarity index 51% rename from delivery/http_server/end2end/setup/seed_data/13_create-delivered-kindbox-for-benefactor1.sql rename to delivery/http_server/end2end/setup/seed_data/5_create-kindboxes-for-benefactor1.sql index 210438e..a8fc2e3 100644 --- a/delivery/http_server/end2end/setup/seed_data/13_create-delivered-kindbox-for-benefactor1.sql +++ b/delivery/http_server/end2end/setup/seed_data/5_create-kindboxes-for-benefactor1.sql @@ -1,18 +1,8 @@ -- +migrate Up INSERT INTO `kind_boxes` (`id`, `kind_box_req_id`, `benefactor_id`, `type`, `serial_number`, `status`, `deliver_refer_time_id`, `deliver_refer_date`, `deliver_address_id`, `sender_agent_id`, `delivered_at`) -VALUES ( - 1, - 1, - 1, - 'on-table', - 'serial-1', - 'delivered', - 1, - NOW() - INTERVAL 7 DAY, - 1, - 1, - NOW() -); +VALUES + -- delivered kindbox for benefactor 1 + (1, 1, 1, 'on-table', 'serial-1', 'delivered', 1, NOW() - INTERVAL 7 DAY, 1, 1, NOW()); -- +migrate Down -DELETE FROM `kind_boxes` WHERE id = 1; \ No newline at end of file +DELETE FROM `kind_boxes`; \ No newline at end of file diff --git a/delivery/http_server/end2end/setup/seed_data/6_create-address-for-benefactor1.sql b/delivery/http_server/end2end/setup/seed_data/6_create-address-for-benefactor1.sql deleted file mode 100644 index c90727c..0000000 --- a/delivery/http_server/end2end/setup/seed_data/6_create-address-for-benefactor1.sql +++ /dev/null @@ -1,16 +0,0 @@ --- +migrate Up -INSERT INTO `addresses` (`id`, `postal_code`, `address`, `lat`, `lon`, `name`, `city_id`, `province_id`, `benefactor_id`) -VALUES ( - 1, - '3719655861', - 'tehran sare koche 1', - 35.632508, - 51.452859, - 'home1', - 8, - 8, - 1 -); - --- +migrate Down -DELETE FROM `addresses` WHERE id = 1; \ No newline at end of file diff --git a/delivery/http_server/end2end/setup/seed_data/7_create-address-for-benefactor2.sql b/delivery/http_server/end2end/setup/seed_data/7_create-address-for-benefactor2.sql deleted file mode 100644 index d54744c..0000000 --- a/delivery/http_server/end2end/setup/seed_data/7_create-address-for-benefactor2.sql +++ /dev/null @@ -1,16 +0,0 @@ --- +migrate Up -INSERT INTO `addresses` (`id`, `postal_code`, `address`, `lat`, `lon`, `name`, `city_id`, `province_id`, `benefactor_id`) -VALUES ( - 2, - '3719655869', - 'tehran sare koche 2', - 35.735638, - 51.312945, - 'home2', - 8, - 8, - 2 - ); - --- +migrate Down -DELETE FROM `addresses` WHERE id = 2; \ No newline at end of file diff --git a/delivery/http_server/end2end/setup/seed_data/8_create-pending-kindboxreq-for-benefactor1.sql b/delivery/http_server/end2end/setup/seed_data/8_create-pending-kindboxreq-for-benefactor1.sql deleted file mode 100644 index bf13617..0000000 --- a/delivery/http_server/end2end/setup/seed_data/8_create-pending-kindboxreq-for-benefactor1.sql +++ /dev/null @@ -1,15 +0,0 @@ --- +migrate Up -INSERT INTO `kind_box_reqs` (`id`, `benefactor_id`, `kind_box_type`, `count_requested`, `status`, `deliver_refer_time_id`, `deliver_refer_date`, `deliver_address_id`) -VALUES ( - 1, - 1, - 'on-table', - 1, - 'pending', - 1, - NOW() + INTERVAL 7 DAY, - 1 -); - --- +migrate Down -DELETE FROM `kind_box_reqs` WHERE id = 1; \ No newline at end of file diff --git a/delivery/http_server/end2end/setup/seed_data/9_create-accepted-kindboxreq-for-benefactor1.sql b/delivery/http_server/end2end/setup/seed_data/9_create-accepted-kindboxreq-for-benefactor1.sql deleted file mode 100644 index 9306726..0000000 --- a/delivery/http_server/end2end/setup/seed_data/9_create-accepted-kindboxreq-for-benefactor1.sql +++ /dev/null @@ -1,16 +0,0 @@ --- +migrate Up -INSERT INTO `kind_box_reqs` (`id`, `benefactor_id`, `kind_box_type`, `count_requested`, `count_accepted`, `status`, `deliver_refer_time_id`, `deliver_refer_date`, `deliver_address_id`) -VALUES ( - 2, - 1, - 'on-table', - 2, - 1, - 'accepted', - 1, - NOW() + INTERVAL 7 DAY, - 1 -); - --- +migrate Down -DELETE FROM `kind_box_reqs` WHERE id = 2; \ No newline at end of file