Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,40 @@ class RssClientTest {
@Test
void fromTistoryRssFeedBy() {
RssClient rssClient = new RssClient();
RssFeeds rssFeeds = rssClient.fromRssFeedBy("https://lazypazy.tistory.com/rss");
String feedUrl = getClass().getClassLoader().getResource("rss/tistory-feed.xml").toString();

RssFeeds rssFeeds = rssClient.fromRssFeedBy(feedUrl);

assertThat(rssFeeds.getRssFeeds()).isNotEmpty();
assertThat(rssFeeds.getRssFeeds().get(0).getTitle()).isEqualTo("Test Article");
}

@Test
void fromYoutubeRssFeedBy() {
SSLUtil.disableSSLVerification();

RssClient rssClient = new RssClient();
RssFeeds rssFeeds = rssClient.fromRssFeedBy(
"https://www.youtube.com/feeds/videos.xml?channel_id=UC-mOekGSesms0agFntnQang");
String feedUrl = getClass().getClassLoader().getResource("rss/youtube-feed.xml").toString();

RssFeeds rssFeeds = rssClient.fromRssFeedBy(feedUrl);

assertThat(rssFeeds.getRssFeeds()).isNotEmpty();
assertThat(rssFeeds.getRssFeeds().get(0).getTitle()).isEqualTo("Test Video");
}

@Test
void fromVelogRssFeedBy() {
SSLUtil.disableSSLVerification();

void fromInvalidRssFeedBy() {
RssClient rssClient = new RssClient();
RssFeeds rssFeeds = rssClient.fromRssFeedBy("https://brunch.co.kr/rss/@@7vZS");

assertThat(rssFeeds.getRssFeeds()).isNotEmpty();
RssFeeds rssFeeds = rssClient.fromRssFeedBy("https://invalid.example.com/nonexistent-feed");

assertThat(rssFeeds.getRssFeeds()).isEmpty();
}

@Test
void fromInvalidRssFeedBy() {
void fromEmptyRssFeedBy() {
RssClient rssClient = new RssClient();
RssFeeds rssFeeds = rssClient.fromRssFeedBy("https://v2.velog.io/rss/junho5336asdfasdf");
String feedUrl = getClass().getClassLoader().getResource("rss/empty-feed.xml").toString();

RssFeeds rssFeeds = rssClient.fromRssFeedBy(feedUrl);

assertThat(rssFeeds.getRssFeeds()).isEmpty();
}
Expand Down
8 changes: 8 additions & 0 deletions backend/src/test/resources/rss/empty-feed.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Empty Blog</title>
<link>https://example.com</link>
<description>No articles</description>
</channel>
</rss>
17 changes: 17 additions & 0 deletions backend/src/test/resources/rss/tistory-feed.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Test Tistory Blog</title>
<link>https://example.tistory.com</link>
<description>Test blog</description>
<image>
<url>https://example.com/blog-image.png</url>
</image>
<item>
<title>Test Article</title>
<link>https://example.tistory.com/1</link>
<description><![CDATA[<p>Test description</p>]]></description>
<pubDate>Mon, 14 Apr 2025 10:00:00 +0900</pubDate>
</item>
</channel>
</rss>
14 changes: 14 additions & 0 deletions backend/src/test/resources/rss/youtube-feed.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:yt="http://www.youtube.com/xml/schemas/2015" xmlns:media="http://search.yahoo.com/mrss/" xmlns="http://www.w3.org/2005/Atom">
<title>Test YouTube Channel</title>
<link rel="alternate" href="https://www.youtube.com/channel/UC-test"/>
<entry>
<title>Test Video</title>
<link rel="alternate" href="https://www.youtube.com/watch?v=test123"/>
<published>2025-04-14T10:00:00+00:00</published>
<media:group>
<media:description>Test video description</media:description>
<media:thumbnail url="https://i.ytimg.com/vi/test123/hqdefault.jpg"/>
</media:group>
</entry>
</feed>
17 changes: 3 additions & 14 deletions terraform/environments/dev/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,9 @@ module "application" {
public_subnet_ids = module.network.public_subnet_ids
service_worker_tags = module.tags.service_worker_tags
server_tags = module.tags.server_tags
}

module "database" {
source = "../../modules/database"

vpc_id = module.network.vpc_id
project_name = var.project_name
db_name = var.db_name
secret_name = var.db_secret_name
ingress_security_group_ids = [module.application.application_sg_id, module.bastion.bastion_sg_id]

private_subnet_ids = module.network.private_subnet_ids
server_tags = module.tags.server_tags
database_tags = module.tags.database_tags
asg_min_size = 1
asg_max_size = 4
asg_desired_capacity = 1
}


16 changes: 0 additions & 16 deletions terraform/environments/dev/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,3 @@ output "application_launch_template_id" {
description = "Launch Template ID for application instances"
value = module.application.launch_template_id
}

# Database
output "database_endpoint" {
description = "Endpoint of the RDS database"
value = module.database.db_instance_endpoint
}

output "database_id" {
description = "ID of the RDS database instance"
value = module.database.db_instance_id
}

output "database_sg_id" {
description = "Security Group ID for the database"
value = module.database.database_sg_id
}
6 changes: 0 additions & 6 deletions terraform/environments/dev/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,3 @@ variable "bucket_name" {
variable "key_pair_name" {
default = "prolog-dev"
}
variable "db_name" {
default = "prolog"
}
variable "db_secret_name" {
default = "secrets/prolog_dev"
}
17 changes: 3 additions & 14 deletions terraform/environments/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,9 @@ module "application" {
public_subnet_ids = module.network.public_subnet_ids
service_worker_tags = module.tags.service_worker_tags
server_tags = module.tags.server_tags
}

module "database" {
source = "../../modules/database"

vpc_id = module.network.vpc_id
project_name = var.project_name
db_name = var.db_name
secret_name = var.db_secret_name
ingress_security_group_ids = [module.application.application_sg_id, module.bastion.bastion_sg_id]

private_subnet_ids = module.network.private_subnet_ids
server_tags = module.tags.server_tags
database_tags = module.tags.database_tags
asg_min_size = 2
asg_max_size = 4
asg_desired_capacity = 2
}


16 changes: 0 additions & 16 deletions terraform/environments/prod/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,3 @@ output "application_launch_template_id" {
description = "Launch Template ID for application instances"
value = module.application.launch_template_id
}

# Database
output "database_endpoint" {
description = "Endpoint of the RDS database"
value = module.database.db_instance_endpoint
}

output "database_id" {
description = "ID of the RDS database instance"
value = module.database.db_instance_id
}

output "database_sg_id" {
description = "Security Group ID for the database"
value = module.database.database_sg_id
}
6 changes: 0 additions & 6 deletions terraform/environments/prod/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,3 @@ variable "bucket_name" {
variable "key_pair_name" {
default = "prolog-prod"
}
variable "db_name" {
default = "prolog"
}
variable "db_secret_name" {
default = "secrets/prolog_prod"
}
10 changes: 7 additions & 3 deletions terraform/modules/application/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ resource "aws_autoscaling_group" "asg" {
version = "$Latest"
}

max_size = 4
min_size = 0
desired_capacity = 0
max_size = var.asg_max_size
min_size = var.asg_min_size
desired_capacity = var.asg_desired_capacity
vpc_zone_identifier = var.private_subnet_ids

// Note: 이후 target_group_arns는 CodeDeploy에서 알아서 관리 예정
Expand All @@ -137,6 +137,10 @@ resource "aws_autoscaling_group" "asg" {
value = var.project_name
propagate_at_launch = true
}

lifecycle {
ignore_changes = [desired_capacity]
}
}

data "aws_ami" "ec2_ami" {
Expand Down
12 changes: 12 additions & 0 deletions terraform/modules/application/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,15 @@ variable "service_worker_tags" {
variable "server_tags" {
type = map(string)
}
variable "asg_min_size" {
type = number
default = 1
}
variable "asg_max_size" {
type = number
default = 4
}
variable "asg_desired_capacity" {
type = number
default = 1
}
58 changes: 0 additions & 58 deletions terraform/modules/database/main.tf

This file was deleted.

39 changes: 0 additions & 39 deletions terraform/modules/database/outputs.tf

This file was deleted.

16 changes: 0 additions & 16 deletions terraform/modules/database/variables.tf

This file was deleted.

7 changes: 0 additions & 7 deletions terraform/modules/secret/main.tf

This file was deleted.

3 changes: 0 additions & 3 deletions terraform/modules/secret/outputs.tf

This file was deleted.

1 change: 0 additions & 1 deletion terraform/modules/secret/variables.tf

This file was deleted.

3 changes: 0 additions & 3 deletions terraform/modules/tags/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ locals {
storage_tags = merge(local.common_tags, {
Role = "${var.project_name}-storage"
})
database_tags = merge(local.common_tags, {
Role = "${var.project_name}-db"
})
service_worker_tags = merge(local.common_tags, {
Role = "service-worker"
})
Expand Down
5 changes: 0 additions & 5 deletions terraform/modules/tags/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ output "storage_tags" {
value = local.storage_tags
}

output "database_tags" {
description = "Tags for database resources"
value = local.database_tags
}

output "service_worker_tags" {
description = "Tags for service worker resources"
value = local.service_worker_tags
Expand Down
Loading