@Test
  public void testAddTags() {
    try {
      prepareTimeseries();
      Map<String, String> newTags =
          new HashMap<String, String>() {
            {
              put("tag2", "new2");
              put("tag3", "new3");
            }
          };
      schemaRegion.addTags(newTags, new PartialPath("root.sg.wf01.wt01.v1.s1"));
      schemaRegion.addTags(newTags, new PartialPath("root.sg.wf01.aligned_device1.s1"));
      try {
        schemaRegion.addTags(newTags, new PartialPath("root.sg.wf01.wt01.v1.s2"));
        Assert.fail();
      } catch (MetadataException e) {
        // expected
        Assert.assertTrue(e.getMessage().contains("already has the tag"));
      }
      try {
        schemaRegion.addTags(newTags, new PartialPath("root.sg.wf01.aligned_device2.s2"));
        Assert.fail();
      } catch (MetadataException e) {
        // expected
        Assert.assertTrue(e.getMessage().contains("already has the tag"));
      }
      checkTags("root.sg.wf01.wt01.v1.s1", newTags);
      checkTags("root.sg.wf01.aligned_device1.s1", newTags);
    } catch (Exception e) {
      logger.error(e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
  }
Prepare timeseries

<p>"root.sg.wf01.wt01.v1.s1" without tags, attributes and alias

<p>"root.sg.wf01.wt01.v1.s2" with tags, attributes and alias

<p>"root.sg.wf01.aligned_device1.(s1,s2)" aligned without tags, attributes and alias

<p>"root.sg.wf01.aligned_device2.(s1,s2)" aligned with tags, attributes and alias
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionAliasAndTagTest.java